Variable length coding method and variable length decoding method

ABSTRACT

A variable length coding method is provided for coding coefficients in each block which are obtained by performing frequency transformation on picture data of a moving picture per block having a predetermined size, and includes: a coefficient scanning step of scanning the coefficients in the block in a predetermined order; and a coding step of coding the coefficients scanned in the coefficient scanning step into variable length codes in a predetermined order by switching a plurality of tables to be used for coding. Here, a direction of switching between the tables may be one-directional. Also, the coding may be non-arithmetic coding.

This application is a divisional of application Ser. No. 10/478,185filed Nov. 19,2003, now U.S. Pat. No. 7,305,035 Stage of InternationalApplication No. PCT/JP03,/04803, filed Apr. 16,2003.

TECHNICAL FIELD

The present invention relates to a variable length coding method forcoding coefficients in each block which are obtained by performingfrequency transformation on picture data of a moving picture per blockhaving a predetermined size, as well as a variable length decodingmethod, and the like.

BACKGROUND ART

In coding a moving picture, compression of information volume is usuallyperformed by utilizing redundancies both in spatial and temporaldirections which the moving picture has. Usually, a transformation intoa frequency domain is used as a method of utilizing the spatialredundancy while inter picture prediction coding is used as a method ofutilizing the temporal redundancy.

In a moving picture coding method which is presently under the processof standardization, quantization is performed on each block sized 4×4pixels so as to generate coefficients after frequency transformation isperformed on such block, with the view to enhance coding efficiency of aconventional MPEG-4 moving picture coding method. Then, scanning isperformed starting at direct current components toward high frequencycomponents, and combinations of a value R (Run, to be simply referred toas “R” hereinafter) indicating the number of consecutive zerocoefficients and a coefficient value L (Level, to be simply referred toas “L” hereinafter) subsequent to it are generated so that a combinationsequence (R, L) is made. After transforming this (R, L) into a codenumber using a predetermined code table, coding is performed bytransforming the code number into a VLC code, further using a singleVariable Length Coding (VLC) table. In the code table, a smaller codenumber is usually assigned as an occurrence probability gets higher. Forexample, a small code number is assigned to a combination where both Rand L indicate small values since its occurrence probability is high. Incertain VLC code tables, a VLC code having a short code length isassigned to a small code number (see reference to ISO/IEC 14496-2:“Information technology—Coding of audio-visual objects—Part2: Visual”7.4.1, pp. 119-120, 1999.12).

However, using the existing method engenders a decrease in codingefficiency since the code length gets longer as the number ofconsecutive zero coefficients R and a coefficient value L get larger.Usually, the decrease in coding efficiency is obvious when a lowfrequency component value is coded since the coefficient value L as alow frequency component value is large.

Namely, as a result of assigning a single VLC table according to theoccurrence probability and a single unique variable length codeaccording to a pair of R and L, the coefficient value L indicating alarge value is transformed into a variable length code having a verylong code length. Even when coding L separately from R (one-dimensionalcoding of L) using a single VLC table, the same problem occurs as in thecase of coding R and L as a pair.

SUMMARY OF THE INVENTION

The present invention is conceived in view of the above problems, andaims to provide a variable length coding method and a variable lengthdecoding method that can improve the coding efficiency when thecoefficient value L is coded.

In order to achieve the above object, the variable length coding methodaccording to the present invention codes coefficients in each blockwhich are obtained by performing frequency transformation on picturedata of a moving picture per block having a predetermined size, themethod comprising: a coefficient scanning step of scanning thecoefficients in each block in a predetermined order; and a coding stepof coding the coefficients scanned in the coefficient scanning step intovariable length codes in a predetermined order by switching between aplurality of tables to be used for coding.

Thus, it is possible to improve the coding efficiency since the variablelength code of the code length based on the coefficient can be adaptedto each table. In other words, it is possible to shorten a code lengthremarkably by switching between the tables depending on the coefficientso that a coefficient may be coded into a variable length code whosecode length is shorter at one table than the other table when thecoefficient is small and a coefficient may be coded into a variablelength code whose code length is shorter at one table than the otherwhen the coefficient is large.

Here, a direction of switching between the plurality of tables may beone-directional. Thus, the frequent switching of the tables is preventedand thereby the number of times switching between the tables decreases.It is therefore possible to enhance the coding efficiency. For example,since a work area in the memory is limited in space, only a table to beused is stored. In this case, it takes time to start coding the nextcoefficient since it takes time to read out the next table from the ROMand expand it in the work area each time the table is switched.Switching in this way one-directionally between the tables is effectivein limiting the number of times switching between the tables and inreducing the total time necessary for coding the next coefficient.

In the coding step, the coding may be performed on each block byswitching between the plurality of tables and the coefficients may benon-zero coefficients that are one-dimensionalized.

It is preferable that the coding is non-arithmetic coding. Thus, when atable to be used for coding is determined, the coding of coefficientsinto variable length codes can be performed by referring to the table.

It is also preferable that each of the tables has a different rate ofchange in code length for coefficients so that a code length for asmallest coefficient gets longer in an ascending order of numbersassigned respectively to each of the tables and a code length for alargest coefficient does not get longer in the same ascending order ofthe numbers. Also, it is also preferable that each of the tables isconstructed so that a rate of increase in code length corresponding toan increase in coefficients gets smaller in an ascending order ofnumbers assigned to each of the tables. Thus, the improvement of thecoding efficiency can be surely realized since a range in which a codelength gets shorter at each table can be assigned.

Also, it is preferable that in the coding step, each of the tables isswitched based on a predetermined threshold value for an absolute valueof the coefficient. Thus, it is easy to judge a timing for switchingbetween the tables and thereby the coding efficiency can be achieved.

It is also preferable that in the coefficient scanning step, thecoefficients are scanned starting at high-frequency components towardlow-frequency components. Since there is a great tendency that theabsolute value of the coefficient gradually gets larger around “1”, itis easy therefore to determine a table for coding the first coefficientin the block, a structure of each table and a threshold value.

Moreover, it is also preferable that in the coding step, a table usedfor coding a current coefficient to be coded is switched to a tablewhose number is larger than the number assigned to the table, when theabsolute value of the current coefficient exceeds a threshold value.Thus, the coding efficiency can be enhanced since a code length can beshortened when the next coefficient is coded.

The variable length decoding method according to the present inventiondecodes variable length codes generated by coding coefficients in eachblock which are obtained by performing frequency transformation onpicture data of a moving picture per block having a predetermined size,the method comprising: a decoding step of decoding the variable lengthcodes in each block into coefficients in a predetermined order byswitching between a plurality of tables to be used for decoding; and acoefficient generation step of generating coefficients in each blockbased on the coefficients generated in the decoding step. Thus, highlycompression coded codes can be properly decoded.

Here, a direction of switching between the plurality of tables may beone-directional.

In the decoding step, the decoding may be performed on said each blockby switching between the plurality of tables.

The coefficients may be non-zero coefficients that areone-dimensionalized.

The decoding may be non-arithmetic decoding.

Each of the tables may have a different rate of change in code lengthfor coefficients so that a code length for a smallest coefficient valuegets longer in an ascending order of numbers assigned respectively toeach of the tables and a code length for a largest coefficient valuedoes not get longer in the same ascending order of the numbers.

Each of the tables may be constructed so that a rate of increase in codelength corresponding to an increase in coefficients gets smaller in anascending order of numbers assigned respectively to each of the tables.

In the decoding step, each of the tables may be switched based on apredetermined threshold value for an absolute value of the coefficient.

In the coefficient generation step, the coefficients may be scanned inan order starting at high-frequency components toward low-frequencycomponents according to an order in which a sequence of the coefficientsis ranged.

Moreover, in the coding step, a following variable length code may bedecoded by switching from a table used for decoding a current variablelength code to be decoded to a table whose number is larger than thenumber assigned to said table, when an absolute value of the decodedcoefficient exceeds a threshold value.

The present invention can be realized not only as a variable lengthcoding method and a variable length decoding method, but also as avariable length coding apparatus and a variable length decodingapparatus having characteristic steps as units included in the variablelength coding method and the variable length decoding method, as amoving picture coding method and a moving picture decoding method usingthe characteristic steps included in the variable length coding methodand the variable length decoding method, and as a program having acomputer execute these steps. Such program can be surely distributed viaa recording medium such as a CD-ROM and a transmission medium such as anInternet.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing a functional structure of a codingapparatus using a variable length coding method and a moving picturecoding method according to a first embodiment of the present invention.

FIG. 2 is a block diagram showing in detail a functional structure of avariable length coding unit shown in FIG. 1.

FIGS. 3A and 3B are pattern diagrams for describing processing executedby an RL sequence generation unit shown in FIG. 2.

FIGS. 4A and 4B are pattern diagrams for describing an RL sequencegenerated by the RL sequence generation unit and reordering processingexecuted by a reordering unit shown in FIG. 2.

FIG. 5 is a diagram showing an example of a code table kept by a tablestorage unit shown in FIG. 2.

FIG. 6 is a diagram showing an example of a VLC table kept by the tablestorage unit shown in FIG. 2.

FIGS. 7A and 7B are pattern diagrams for describing another example ofthe RL sequence generated by the RL sequence generation unit and thereordering processing executed by the reordering unit.

FIG. 8 is a block diagram showing a functional structure of a decodingapparatus using a variable length decoding method and a moving picturedecoding method according to a second embodiment of the presentinvention.

FIG. 9 is a block diagram showing in detail a functional structure of avariable length decoding unit shown in FIG. 8.

FIGS. 10A and 10B are pattern diagrams for describing an RL sequencegenerated by a code conversion unit shown in FIG. 9 and reorderingprocessing executed by a reordering unit shown in FIG. 9.

FIG. 11 is a pattern diagram for describing processing executed by acoefficient generation unit shown in FIG. 9.

FIGS. 12A and 12B are pattern diagrams for describing another example ofthe RL sequence generated by the code conversion unit and the reorderingprocessing executed by the reordering unit.

FIG. 13 is a block diagram showing a structure of a coding apparatusaccording to a third embodiment of the present invention.

FIG. 14 is a block diagram showing an internal structure of the variablelength coding unit according to the third embodiment of the presentinvention.

FIGS. 15A and 15B are pattern diagrams showing schematically an RLsequence outputted from the RL sequence generation unit according to thethird embodiment of the present invention.

FIGS. 16A, 16B and 16C are pattern diagrams showing schematically the RLsequence outputted by the RL sequence generation unit according to thethird embodiment of the present invention.

FIG. 17 is a transition diagram showing a method of switching betweenprobability tables according to the third embodiment of the presentinvention.

FIG. 18 is a probability table contents display diagram showing thecontents of a probability table according to the third embodiment of thepresent invention.

FIG. 19 is a block diagram showing a structure of a picture decodingapparatus according to a fourth embodiment of the present invention.

FIG. 20 is a block diagram showing an internal structure of a variablelength decoding unit according to the fourth embodiment of the presentinvention.

FIG. 21 is a table diagram showing an example of a binary table.

FIG. 22 is a block diagram showing a functional structure of a codingapparatus, to which a variable length coding method and a moving picturecoding method according to a fifth embodiment of the present invention,are applied.

FIG. 23 is a block diagram showing in detail a functional structure of avariable length coding unit shown in FIG. 22.

FIGS. 24A and 24B are diagrams showing an example of L sequence and Rsequence generated by an RL sequence generation unit shown in FIG. 23.

FIG. 25 is a diagram showing a structural example for each VLC tablestored in a storage unit shown in FIG. 23.

FIG. 26 is a diagram showing a structural example of a threshold valuetable stored in the storage unit shown in FIG. 23.

FIG. 27 is a flowchart showing processing of assigning variable lengthcodes, executed by a code assignment unit shown in FIG. 23.

FIG. 28 is a diagram showing a relationship between the VLC table usedfor coding and a threshold value.

FIG. 29 is a pattern diagram showing how the code assignment unitperforms coding processing.

FIG. 30 is a block diagram showing a functional structure of a decodingapparatus using a variable length decoding method and a moving picturedecoding method according to a sixth embodiment of the presentinvention.

FIG. 31 is a block diagram showing in detail a functional structure of avariable length decoding unit shown in FIG. 30.

FIGS. 32A, 32B and 32C are illustrations for a case of performing themoving picture coding method according to the first, third and fifthembodiments or the moving picture decoding method according to thesecond, fourth and sixth embodiments in a computer system using aflexible disk on which a program for executing these methods isrecorded.

FIG. 33 is a block diagram showing a whole configuration of a contentdelivery system for realizing a content delivery service.

FIG. 34 is an illustration showing a cell phone using the moving pictureprediction method, the moving picture coding apparatus and the movingpicture decoding apparatus according to the present invention.

FIG. 35 is a block diagram showing a structure of a cell phone accordingto the present invention.

FIG. 36 is a block diagram showing a whole configuration of a digitalbroadcasting system according to the present invention.

DETAILED DESCRIPTION OF THE INVENTION

The following describes the embodiments according to the presentinvention with reference to the diagrams.

(First Embodiment)

FIG. 1 is a block diagram showing a functional structure of a codingapparatus to which the moving picture coding method according to thepresent invention is applied. The first embodiment illustrates thefunctional structure in a case of intra-picture coding an input pictureusing the moving picture coding method according to the presentinvention.

As shown in the diagram, a coding apparatus 100 a is comprised of ablock conversion unit 110, a frequency transformation unit 120, aquantization unit 130 and a variable length coding unit 140. Each unitcomposing such coding apparatus 100 a is realized with a CPU, a ROM forstoring in advance a program or data executed by the CPU and a memoryfor providing a work area when the program is executed as well as forstoring temporally the input picture, or the like.

The block conversion unit 110 divides the input picture into blocks,each of which is sized 4 (horizontal)×4 (vertical) pixels and outputseach pixel block to the frequency transformation unit 120.

The frequency transformation unit 120 performs frequency transformationon the inputted pixel blocks and converts them into frequencycoefficients and then outputs the transformed frequency coefficients tothe quantization unit 130.

The quantization unit 130 performs quantization processing on theinputted frequency coefficients. The quantization processing here meansprocessing equivalent to dividing a frequency coefficient by apredetermined quantization value. Moreover, a quantization value variesdepending generally on a pixel block and a frequency band. The quantizedfrequency coefficients are inputted to the variable length coding unit140.

The variable length coding unit 140 performs variable length coding onvalues of the frequency coefficients in the block whose size ispredetermined (4×4 pixels).

FIG. 2 is a block diagram showing in detail a functional structure ofthe variable length coding unit 140.

The variable length coding unit 140 includes an RL sequence generationunit 141, a reordering unit 142, a code assignment unit 143 and a tablestorage unit 144.

The quantized frequency coefficients outputted from the quantizationunit 130 are inputted to the RL sequence generation unit 141.

The RL sequence generation unit 141 first converts the quantizedfrequency coefficients into one-dimensionalized coefficients, using apredetermined scanning method. The RL sequence generation unit 141 thengenerates a sequence (to be referred to as “RL sequence” hereinafter)made up of a combination of a value R indicating the number ofconsecutive zero coefficients and a non-zero coefficient value Lsubsequent to it, (to be referred to as “RL value” hereinafter). Anexample of this is explained with reference to FIGS. 3 and 4.

FIG. 3A is a diagram showing the quantized frequency coefficients in ablock, outputted from the quantization unit 130. Here, the upper leftfrequency coefficient denotes a direct-current component, and frequencycomponents in the horizontal direction become larger toward right, whilefrequency components in the vertical direction become larger downward.FIG. 3B is a diagram showing a scanning method for one-dimensionalizingthe quantized frequency coefficients. The RL sequence generation unit141 one-dimensionalizes the coefficients by performing scanning startingat the low-frequency domain toward the high-frequency domain.

A result of generating an RL sequence for the one-dimensionalizedcoefficient values, performed by the RL sequence generation unit 141, isshown in FIG. 4A. In FIG. 4A, EOB (End Of Block) is an identifierindicating that all the subsequent coefficient values in the block are“0”. Generally, a coefficient value is more likely to be “0” in thehigh-frequency domain. Therefore, by performing scanning starting at thelow-frequency domain toward the high-frequency domain, it is possible toreduce the amount of information included in the RL sequence. Thegenerated RL sequence is inputted to the reordering unit 142.

The reordering unit 142 sorts the inputted RL sequence in reverse order.However, the EOB shall not be reordered. The FIG. 4B shows a statusafter the reordering is performed. The RL sequence thus reordered isinputted to the code assignment unit 143.

The table storage unit 144 keeps in advance a table (a code table, seereference to FIG. 5) correlating RL values with code numbers assigned tothe RL values as well as a plural kinds of tables (VLC tables in FIG. 6)correlating code numbers with variable length codes, and the like.

The code assignment unit 143 assigns the variable length codes to eachpair in the RL sequence using the tables stored in the table storageunit 144.

To be more precise, the code assignment unit 143 firstly assigns thecode numbers to the RL values. Here, the conversion of the RL valuesinto the code numbers is operated using a predetermined code table (seereference to FIG. 5) stored in the table storage unit 144.

FIG. 5 is a diagram showing an example of the code table.

The code table is constructed making use of a tendency that the smallercode numbers are usually assigned as the probability of the RL valuesbecome larger and the probability increases as the RL values indicatethe smaller values. With the use of this table, for example, the codenumber “2” is assigned to the first RL value (0, −1). For the second tofifth RL values (1, 1), (0, −2), (0, 3) and (0, 4), the code numbers“3”, “8”, “13” and “15” are assigned respectively.

Then, the code assignment unit 143 converts the code numbers into thevariable length codes. For the conversion of the code numbers into thevariable length codes, a plurality of VLC tables (see reference to FIG.6) stored in the table storage unit 144 are used.

FIG. 6 is a diagram showing an example of the VLC table.

In the first embodiment, two kinds of VLC tables are stored.

The first VLC table 1 and the second VLC table 2 are constructed so thatthe variable length code becomes longer as the code number becomeslarger. The VLC table 1 is constructed so that the variable length codebecomes shorter as the code number gets smaller, compared to the VLCtable 2, whereas the VLC table 2 is constructed so that the variablelength code becomes shorter as the code number gets larger, compared tothe VLC table 1. Namely, a short code is assigned to a small code numberin the VLC table 1 and a short code is assigned to a large code numberin the VLC table 2.

The VLC table 1 is used for the first RL value. In this case, the codenumber for the first RL value is “2”, therefore, the variable lengthcode is “011”. The conversion of the code numbers into the variablelength codes is performed subsequently, and when an absolute value of Lexceeds a threshold value, the VLC table 2 is used for the following RLvalues. Assume that a threshold value of the absolute value of L is “2”,the absolute value of L exceeds the threshold value at the fourth RLvalue (0, 3). Therefore, the VLC table 1 is used for the first throughthe fourth RL values and the VLC table 2 is used for the fifth RL valueand thereafter.

Here, the absolute value of L again goes below the threshold value atthe seventh RL value (1, 2), however, the table is not switched to theVLC table 1, and the VLC table 2 is used for the conversion. This meansthat a direction of switching between the tables is one-directional.Here, “one-directional” means that the table once used is not to be usedagain. Thus, the frequent switching of the tables is prevented andthereby the number of times switching between the tables decreases. Theabsolute value of L generally tends to increase when the coefficientsare one-dimensionalized starting at high-frequency components toward thelow-frequency components. Therefore, in many cases, once the absolutevalue of L goes beyond the threshold value, it is only the coefficientthat goes below the threshold value even the absolute value of L againgoes below the threshold value. It is therefore possible to improvecoding efficiency by not using again the used tables even when theabsolute value of L again goes below the threshold value. For example,usually, only the table to be used next is stored in a work area sincethe work area in the memory is limited in space. In this case, it takestime until the next coefficient starts being coded since it takes timeto read out the next table from the ROM and expand it in the work areaeach time the table is switched. In this way, switchingone-directionally between the tables is effective in limiting the numberof times switching between the tables and in abbreviating a total timenecessary to start coding the next coefficient.

The RL sequence generation unit 141 performs scanning on coefficientvalues in a coefficient value sequence starting at the low-frequencycomponents toward the high-frequency components whereas the codeassignment unit 143 subsequently performs variable length codingstarting from the end of the coefficient value sequence. Thisfacilitates quick decisions on a table to be used for coding the firstcoefficient value in the block, a structure of each table and athreshold value, since the absolute value of the coefficient tends tobecome larger around “1”.

Thus, the variable length coding method according to the firstembodiment performs scanning on the frequency coefficients in the block,starting at the low-frequency domain toward the high-frequency domain.Then, a sequence of RL values, each of which is a combination of a valueR indicating the number of consecutive zero coefficients and acoefficient value L indicating a non-zero coefficient is generated forthe one-dimensionalized coefficients. The RL values are converted intothe variable length codes in an order reverse to the order for scanning.Namely, the RL values may be converted directly. A plurality of VLCtables are prepared for converting the RL values into the variablelength codes. Firstly, the first VLC table is used for the conversion,and when the absolute value of L exceeds the threshold value, the secondVLC table is used for the subsequent RL values. Here, in the first VLCtable, the variable length code gets shorter as the code number becomessmaller, compared to the second VLC table, and in the second VLC table,the variable length code gets shorter as the code number becomes larger,compared to the first VLC table.

The absolute value of L usually becomes larger in the low-frequencydomain, therefore, the absolute value of L become larger when the RLvalues are converted into the variable length codes in an order reverseto the order in which the RL values are generated by scanning thecoefficients from the low-frequency domain toward the high-frequencydomain.

Therefore, when the absolute value of L gets larger after the absolutevalue of L has exceeded the threshold value, that is, by using the VLCtable in which the variable length code becomes shorter as the codenumber gets larger, the total amount of code can be reduced. Namely, thetotal code amount for L can be reduced also by coding L and Rseparately, and also, by using plural VLC tables.

The first embodiment describes the case of coding the picture usingintra-picture coding, however, the same effects can be obtained for thecase in which a picture is coded by means of inter-picture coding byperforming motion compensation and others on an input moving picture,using the method according to the present embodiment.

Also, the first embodiment describes the case of dividing the inputpicture into a block with the size of 4 (horizontal)×4 (vertical)pixels, however, a different size can be given for the size of theblock.

The first embodiment describes a method of scanning a block withreference to FIG. 3, however, other scanning method can be employedproviding that the scanning is performed starting at the low-frequencydomain toward the high-frequency domain.

Also, an example of the code table is described with reference to FIG.5, however, it may be a different code table.

Similarly, an example of the VLC table is described with reference toFIG. 6, however, it may be a different table.

The case of using two VLC tables is described in the present embodiment,however, three VLC tables can be used with the use of plural thresholdvalues and the VLC tables may be switched each time each threshold valueis exceeded.

In the first embodiment, it is explained that the VLC tables areswitched when the absolute value of L has exceeded the threshold value,however, the same effects can be obtained in switching between the VLCtables when the code number has exceeded the threshold value.

It is also described in the present embodiment that the EOB is added tothe end of the RL sequence, however, the number of the RL values may beadded to the head of the RL sequence. FIGS. 7A and 7B show the number ofRL values to be coded and the RL sequence, corresponding to FIGS. 4A and4B for this case.

In the code table shown in FIG. 5, the assignment of the code number tothe EOB is unnecessary.

(Second Embodiment)

FIG. 8 is a block diagram showing a functional structure of a decodingapparatus to which the variable length decoding method according to theembodiments of the present invention is applied. Here, the bit streamgenerated using the variable length coding method according to thepresent invention described in the first embodiment shall be inputted.

As shown in FIG. 8, a decoding apparatus 500 a is comprised of avariable length decoding unit 510, an inverse quantization unit 520, aninverse frequency transformation unit 530 and a picture memory 540. Eachunit composing such decoding apparatus 500 a, like the coding apparatus100 a, is realized with a CPU, a ROM for storing in advance a program ordata executed by the CPU and a memory for providing a work area when theprogram is executed as well as for storing temporally the input picture,or the like.

The bit stream is inputted to the variable length decoding unit 510. Thevariable length decoding unit 510 decodes the bit stream that isvariable length coded. The bit stream is generated by dividing thepicture data into blocks, each of which has a predetermined size,one-dimensionalizing the frequency coefficients in the block using apredetermined scanning method and coding a sequence of the combinations(RL values) of the value R indicating the number of consecutive zerocoefficients and the coefficient value L subsequent to it.

FIG. 9 is a block diagram showing in detail a functional structure ofthe variable length decoding unit 510.

As shown in FIG. 9, the variable length decoding unit 510 includes acode conversion unit 511, a table storage unit 512, a reordering unit513 and a coefficient generation unit 514.

The table storage unit 512 is constructed in the same manner as thetable storage unit 144 and stores in advance plural kinds of tables (VLCtables in FIG. 6) correlating the code numbers with the variable lengthcodes and the table (a code table, see reference to FIG. 5) correlatingthe RL values with the code numbers assigned to them.

The code conversion unit 511 converts variable length code into codenumbers for the inputted bit stream using the tables (plural VLC tables)stored in the table storage unit 512. The conversion of the variablelength codes into the code numbers is performed using a plurality of VLCtables. The VLC tables are stored in the table storage unit 512 and thevariable length codes are converted into the code numbers by referringto the table storage unit 512.

An example of the VLC table is explained with reference to FIG. 6. Here,two types of VLC tables are stored. A shorter code is assigned to asmaller code number in the VLC table 1 whereas a shorter code isassigned to a larger code number in the VLC table 2. Assume that a codeof a head part of the inputted bit stream is“01100100000100100011100010011” here. The VLC table 1 is used for thefirst variable length code. When the VLC table 1 in FIG. 6 is referredto, the variable length code “011” corresponds to the inputted bitstream, therefore, the code number is “2” in this case.

The code conversion unit 511 then converts the obtained code number toan RL value. In this case, a predetermined code table is used. The codetable is stored in the table storage unit 512, and the code number isconverted into an RL value with reference to the table storage unit 512.An example of the code table is shown in FIG. 5. The code number, inthis case, is “2”, therefore, the RL value is (0, −1).

Similarly, in sequentially proceeding the conversion of the variablelength codes into the code numbers one by one using the VLC table 1, thevariable length code “00100” is converted to the code number “3”, thevariable length code “0001001” to the code number “8” and the variablelength code “0001110” to the code number “13” respectively and therespective code numbers are further converted to the RL values (1, 1),(0, −2) and (0, 3).

Here, when the absolute value of L of the obtained RL value, exceeds thethreshold value, the code conversion unit 511 uses the VLC table 2 forthe conversion of the subsequent variable length codes. Assume that thethreshold value of the absolute value of L is “2”, the absolute value ofL goes beyond the threshold value at the fourth RL value (0, 3).Therefore, for the subsequent RL values, the conversion is operatedusing the VLC table 2. Consequently, the next variable length code“0010011” is converted to the code number “15” and further converted tothe RL value (0, 4).

Even when the absolute value L of the RL value obtained in thesubsequent decoding, goes below the threshold value again, the switchingto the VLC table 1 is not operated, and the VLC table 2 is used for theconversion. Thus, when the RL values equivalent to a single block aregenerated (an EOB is detected), they are inputted to the reordering unit513. Here, it is assumed that the RL sequence shown in FIG. 10A isgenerated.

The reordering unit 513 sorts the inputted RL sequence in reverse order.However, the EOB shall not be reordered. FIG. 10B shows the status afterthe reordering. The RL sequence thus reordered is inputted to thecoefficient generation unit 514.

The coefficient generation unit 514 converts the inputted RL sequenceinto coefficients and two-dimensionalizes a coefficient block using apredetermined scanning method. When the RL sequence is converted intothe coefficients, a coefficient “0” is generated for the numberindicated by R based on the predetermined scanning order, and then thecoefficient indicated by L is generated. Here, assuming that thecoefficients are scanned in zigzags starting at the low-frequency domaintoward the high-frequency domain, the RL sequence shown in FIG. 10B isconverted into the coefficient block shown in FIG. 11. The generatedcoefficient block is inputted to the inverse quantization unit 520.

The inverse quantization unit 520 performs inverse quantizationprocessing on the inputted coefficient block. The inverse quantizationhere means to integrate a predetermined quantization value to eachcoefficient in the coefficient block. The quantized value here dependsusually on a block or a frequency band using either a value obtainedfrom the bit stream or a predetermined value. The inverse quantizedcoefficient block is inputted to the inverse frequency transformationunit 530.

The inverse frequency transformation unit 530 performs inverse frequencytransformation on other inverse quantized coefficient blocks so as toconvert them into pixel blocks. The converted pixel blocks are inputtedto the picture memory 540.

The decoded pixel blocks are stored one by one in the picture memory540, and outputted as an output picture after the pixel blocksequivalent to a single picture are stored.

Thus, the variable length decoding method according to the presentinvention decodes an input bit stream firstly by using the first VLCtable and generates a sequence of RL values which is a combination of Rindicating the number of consecutive zero coefficients and L indicatinga non-zero coefficient subsequent to it. Then, when the absolute valueof L exceeds the threshold value, the second VLC table is used fordecoding the subsequent variable length codes. The RL value is thenconverted into a coefficient based on a predetermined method of scanningthe block after the RL values are put in reverse order.

With the above processing, it is possible to decode properly the bitstream that is coded using the variable length coding method accordingto the present invention by using the variable length decoding method ofthe present invention.

In the second embodiment, the case of decoding the bit stream generatedusing intra-picture coding is explained, however, the same effects canbe obtained in a case of decoding the bit stream generated by performinginter-picture coding on an input moving picture, with the use of motioncompensation and others, employing the method according to the presentembodiment.

The second embodiment describes the case in which the input picture isdivided into blocks, each of which is sized 4 (horizontal)×4 (vertical)pixels and coded, however, a different size can be given for the size ofthe block.

Also, the second embodiment describes a method of scanning a block withreference to FIG. 11, however, different scanning order may be usedproviding that it is the one used for coding.

In the second embodiment, the example of the code table is explainedwith reference to FIG. 11, however, a different code table can be usedproviding that it is the one used for coding.

Also, an example of the VLC table is explained with reference to FIG. 6,however, a different table can be used providing that it is the one usedfor coding. The case of using two VLC tables is described in the presentembodiment, however, three VLC tables may be used with the use of pluralthreshold values, and the VLC table can be switched each time eachthreshold value is exceeded. However, the structure of the VLC table andthe threshold value shall be the same as those used for coding.

The second embodiment also describes the case of switching between theVLC tables when the absolute value of L has exceeded the thresholdvalue, however, the same effects can be obtained in switching betweenthe VLC tables when the code number has exceeded the threshold value.

The case of decoding the bit stream coded with the EOP attached to theend of the RL sequence is described in the second embodiment, however,the bit stream that is coded with the number of RL values attached tothe head of the RL sequence may be decoded. FIGS. 12A and 12B show thenumber of RL values and the RL sequence obtained from the decodingprocessing, corresponding to FIGS. 10A and 10B for this case. In thiscase, in the code table shown in FIG. 5, the assignment of the codenumber to the EOB is unnecessary.

The variable length coding method according to the present inventionperforms scanning on the frequency coefficients in the block starting atthe low-frequency domain toward the high-frequency domain andone-dimensionalizes them. Then, a sequence of RL values, each of whichis a combination of R, the number of consecutive zero coefficients, andL, the non-zero coefficient subsequent to it, is generated for theone-dimensionalized coefficients. The RL values are then converted intovariable length codes in an order reverse to the order of scanning. Aplurality of VLC tables are prepared for converting the RL values intothe variable length codes. Then, the conversion is made firstly by usingthe first VLC table, and when the absolute value of L or the code numberexceeds the threshold value, the second VLC table is used for convertingthe subsequent RL values. In this case, in the first VLC table, thevariable length code becomes shorter as the code number gets smaller,compared to the second VLC table, and in the second VLC table, thevariable length code becomes shorter as the code number gets larger,compared to the first VLC table.

Usually, the absolute value of L and the code number become larger inthe low-frequency domain, therefore, the absolute value of L gets largerwhen the RL values are converted into the variable length codes in anorder reverse to the order in which the RL values are generated byperforming scanning starting at the low-frequency domain toward thehigh-frequency domain. Therefore, the total code amount can be reducedby using the VLC table in which the variable length code gets shorter asthe code number becomes larger, after the absolute value of L hasexceeded the threshold value.

The variable length decoding method according to the present inventiondecodes firstly the input bit stream using the first VLC table andgenerates a sequence of the RL values, each of which is a combination ofR, the number of consecutive zero coefficients, and L, the non-zerocoefficient that follows it. When the absolute value of L or the codenumber exceeds the threshold value, the second VLC table is used fordecoding the subsequent variable length codes. The RL values are thenconverted to the coefficients based on the predetermined order ofscanning the block, after the RL values are put in reverse order.

With the above processing, it is possible, by using the variable lengthdecoding method according to the present invention, to decode properlythe bit stream that is coded using the variable length coding methodaccording to the present invention.

(Third Embodiment)

The following describes a coding apparatus according to the thirdembodiment with reference to the diagrams.

FIG. 13 is a block diagram showing a structure of the coding apparatus100 b according to the third embodiment of the present invention.

This picture coding apparatus 100 b, which performs intra-picture codingon an input picture (picture data) with improved coding efficiency, iscomprised of a block conversion unit 101, a frequency transformationunit 102, a quantization unit 103, and a variable length coding unit150.

The block conversion unit 101 divides the input picture into pixelblocks, each of which has a size of 4 (horizontal)×4 (vertical) pixels,and outputs them to the frequency transformation unit 102.

The frequency transformation unit 102 performs frequency transformationon each of the divided pixel blocks so as to generate frequencycoefficients. Then, the frequency transformation unit 102 outputs thegenerated frequency coefficients to the quantization unit 103.

The quantization unit 103 performs quantization on the frequencycoefficients outputted by the frequency transformation unit 102. Thequantization here means processing equivalent to dividing a frequencycoefficient by a predetermined quantization value. Moreover, aquantization value varies depending generally on a pixel block and afrequency band. Subsequently, the quantization unit 103 outputs thequantized frequency coefficients to the variable length coding unit 150.

The variable length coding unit 150 performs variable length coding onthe frequency coefficients quantized by the quantization unit 103.

FIG. 14 is a block diagram showing an internal structure of the variablelength coding unit 150.

As shown in FIG. 14, the variable length coding unit 150 is made up ofan RL sequence generation unit 201, a reordering unit 202, abinarization unit 203, a table storage unit 204, and an arithmeticcoding unit 205.

The RL sequence generation unit 201 converts the quantized frequencycoefficients (to be abbreviated as “coefficients” hereinafter) outputtedby the quantization unit 103 into one-dimensionalized coefficients,using a predetermined scanning method. Then, the RL sequence generationunit 201 generates a sequence (to be referred to as “RL sequence”hereinafter) made up of combinations of a value R indicating the numberof consecutive zero coefficients and a coefficient value L indicating anon-zero coefficient (to be referred to as “RL values” hereinafter). Anexample of this is described with reference to FIGS. 15 and 16.

FIG. 15A shows a coefficient block made up of a plurality ofcoefficients outputted by the quantization unit 103. Here, the upperleft frequency coefficient denotes a direct-current component, andfrequency components in the horizontal direction become larger towardright, while frequency components in the vertical direction becomelarger downward.

FIG. 15B is an explanation diagram for explaining a scanning method forone-dimensionalizing a plurality of coefficients in a coefficient block.As indicated by arrows in FIG. 15B, the RL sequence generation unit 201one-dimensionalizes the coefficients by performing scanning in thecoefficient block starting at the low-frequency domain toward thehigh-frequency domain.

FIG. 16A shows an RL sequence outputted by the RL sequence generationunit 201. In FIG. 16A, the first number indicates the number ofcoefficients. Generally, a coefficient value is more likely to be “0” inthe high-frequency domain. Therefore, by performing scanning starting atthe low-frequency domain toward the high-frequency domain, it ispossible to reduce the amount of information included in an RL sequence(of which, the amount of information of the numbers R). The generated RLsequence is inputted to the reordering unit 202.

The reordering unit 202 sorts the inputted RL sequence in reverse order.However, the number of coefficients shall not be reordered.

FIG. 16B shows the RL sequence reordered by the reordering unit 202. Byperforming reordering in this way, it is possible to reduce the amountof information as described above, and consequently toone-dimensionalize coefficients by applying scanning to the coefficientblock from the high-frequency domain toward the low-frequency domain.Subsequently, the RL sequence thus reordered is outputted to thebinarization unit 203.

The binarization unit 203 performs binarization on the number ofcoefficients and each RL value, i.e. converts them into binary data madeup of “0”s and “1”s. Here, the value R and the coefficient value L arebinarized separately.

FIG. 16C shows only the coefficient values L in the RL sequencereordered by the reordering unit 202. The absolute values and signs ofthese coefficient values L are separately processed. Moreover, thebinarization unit 203 performs binarization on the values R and theabsolute values of the coefficient values L, using a predeterminedbinary table as shown in FIG. 21, for example. Then, the binary unit 203outputs, to the arithmetic coding unit 205, binary data resulted fromperforming binarization on them.

The arithmetic coding unit 205 performs binary arithmetic coding on thevalues of the numbers R and the absolute values of the coefficientvalues L represented as binary data, while coding the signs of thecoefficient values L at the same time. An explanation is given here forthe arithmetic coding to be performed on the absolute value of thecoefficient value L. The arithmetic coding unit 205 uses a plurality ofprobability tables by switching between them, when performing arithmeticcoding on the absolute value of the coefficient value L represented asbinary data. The plurality of probability tables are stored in the tablestorage unit 204.

FIG. 17 is a transition diagram showing a method of switching betweenthe probability tables.

As FIG. 17 shows, the arithmetic coding unit 205 uses four probabilitytables, out of which the probability table 1 is used to performarithmetic coding on the absolute value of the first coefficient valueL. Meanwhile, for the subsequent coefficient values L, the arithmeticcoding unit 205 switches to another probability table for use, dependingon the table number of the probability table used for coding theabsolute value of the previous coefficient value L as well as on theabsolute value. Here, four probability tables are the probability table1, the probability table 2, the probability table 3, and the probabilitytable 4, and the table number of the probability table 1 is “1”, thetable number of the probability table 2 is “2”, the table number of theprobability table 3 is “3”, and the table number of the probabilitytable 4 is “4”.

More specifically, the probability table 2 is used when one of thefollowings is satisfied: when the probability table 1 is used to codethe absolute value of the previous coefficient value L and its absolutevalue is “1”; and when the probability table 2 is used to code theabsolute value of the previous coefficient value L and its absolutevalue is “1”. Meanwhile, the probability table 3 is used when one of thefollowings is satisfied: when the probability table 1 is used to codethe absolute value of the previous coefficient value L and its absolutevalue is “2”; when the probability table 2 is used to code the absolutevalue of the previous coefficient value L and its absolute value is “2”;and when the probability table 3 is used to code the absolute value ofthe previous coefficient value L and its absolute value is “2 orsmaller”. And, the probability table 4 is used when one of thefollowings is satisfied: when the absolute value of the previouscoefficient value L is “3 or larger”; and when the probability table 4is used to code the absolute value of the previous coefficient value L.

As described above, the probability tables are switched in onedirection, that is, from a probability table with a smaller table numberto a probability table with a larger table number. Accordingly, evenwhen the absolute value of the previous coefficient value L is equal toor smaller than a predetermined threshold value, the probability tablesshall not be switched back in the opposite direction. This is the pointthat distinguishes the present invention from the existing technique.

FIG. 18 is a probability table contents display diagram showing thecontents of the aforementioned four probability tables 1˜4.

As shown in FIG. 18, each of the four probability tables 1˜4 is made upof the probability with which “0” occurs and the probability with which“1” occurs.

For example, the probability table 1 is made up of the probability “0.1”with which “0” occurs and the probability “0.9” with which “1” occurs,and the probability table 2 is made up of the probability “0.2” withwhich “0” occurs and the probability “0.8” with which “1” occurs.

To put it another way, when the absolute value of the coefficient valueL is “2”, the result of binarizing “2” is “01”, and therefore, whenusing the probability table 1 to perform arithmetic coding on “01”, thearithmetic coding unit 205 performs arithmetic coding on “01” using theprobability “0.1” corresponding to “0” in such “01” and the probability“0.9” corresponding to “1” in such “01”.

Here, since the sum of the probability with which “0” occurs and theprobability with which “1” occurs is 1.0, it is not necessary to holdboth of these probabilities, and therefore only either of theprobabilities may be retained.

The following explains an example of switching between probabilitytables in a case where coding is performed on the absolute values(binarized ones) of the coefficient values L shown in FIG. 16C.

The arithmetic coding unit 205 uses the probability table 1 for theabsolute value of the first coefficient value L (−2). Here, since theabsolute value of such coefficient value L is 2, the arithmetic codingunit 205 switches the probability table 1 to the probability table 3 foruse. Accordingly, the arithmetic coding unit 205 uses the probabilitytable 3 to perform arithmetic coding on the absolute value of the secondcoefficient value L (3). Here, since the absolute value of suchcoefficient value L is “3”, the arithmetic coding unit 205 switches theprobability table 3 to the probability table 4 for use. Accordingly, thearithmetic coding unit 205 uses the probability table 4 to performarithmetic coding on the absolute value of the third coefficient value L(6). Here, since the probability table to be used has been switched tothe probability table 4, the arithmetic coding unit 205 uses theprobability table 4 to perform arithmetic coding on the absolute valuesof all the subsequent coefficient values L. For example, the absolutevalue of the fifth coefficient value L is “2”, but unlike the existingtechnique, the arithmetic coding unit 205 uses the probability table 4when performing arithmetic coding on the absolute value of the sixthcoefficient value L and thereafter, without switching to anotherprobability table.

Furthermore, since each of the probability tables are updated as neededdepending on whether an input is “0” or “1”, such probability tables areupdated to be adapt to the input.

As described above, in the variable length coding method employed by thevariable length coding unit 150 in the picture coding apparatus 100 baccording to the present invention, one-dimensionalization is performedon coefficients within a coefficient block by scanning them starting atthe low-frequency domain toward the high-frequency domain. Then, itgenerates a sequence of RL values (RL sequence) made up of a combinationof a number R indicating consecutive zero coefficient values and anon-zero coefficient value L subsequent to it. Such RL values are thenconverted into variable length codes in an order opposite to the one inwhich the scanning has been applied. When the RL values are convertedinto variable length codes, numbers R, the absolute values ofcoefficient values L and the signs of the coefficient values L areconverted separately. When they are converted, binarization is performedfirst, which is followed by arithmetic coding. In order to performarithmetic coding on the absolute values of the coefficient values L, aplurality of probability tables are switched between them. When aprobability table is switched to another probability table, aprobability table to be used for coding the absolute value of the nextcoefficient value L is determined depending on the table number of thecurrent probability table and the absolute value of the currentcoefficient value L. The probability tables shall be switched only inone direction, and once the absolute value of a coefficient value Lexceeds a predetermined value, the same probability table is used fromthen on for performing arithmetic coding.

When scanning is applied from the high-frequency domain first and thento the low-frequency domain, it is likely that the absolute value of thecoefficient value L becomes larger, since the absolute value ofcoefficient value L becomes generally larger toward the low-frequencydomain. Therefore, once the absolute value of the coefficient value Lexceeds a predetermined value, even if the absolute value of anothercoefficient value L becomes smaller than the predetermined value afterthat, it is highly possible that only the absolute value of suchcoefficient value is small. Thus, by performing arithmetic coding withthe use of the same probability table, update of a probability tablebecomes more easily adaptive to the inputs. This consequently makes itpossible for the occurrence probability of symbols (“0” or “1” in binarydata) in each probability table to be more biased (i.e. the occurrenceprobability of either “0” or “1” becomes a value closer to 1.0).Arithmetic coding has a characteristic that the more biased probabilityvalues in a probability table are, the higher the coding efficiencybecomes. Consequently, the coding efficiency can be improved by usingthe variable length coding method according to the present invention.

The picture coding apparatus according to the present invention has beenexplained using the present embodiment, but the present invention is notlimited to this.

In the present embodiment, for example, an explanation is provided forthe case where a picture is coded by means of intra-picture coding, butthe same effects can be obtained also for the case where a picture iscoded by means of inter-picture coding by performing motion compensationand others on an input moving picture.

Furthermore, in the present embodiment, although an explanation is givenfor the case where an input picture is divided into pixel blocks, eachof which has a size of 4 (horizontal)×4 (vertical) pixels, a differentsize can be given for the pixel block.

Also, in the present embodiment, although FIG. 15B is used to explain amethod of performing scanning within a coefficient block, anotherscanning order may also be employed as long as scanning is performedfrom the low-frequency domain toward the high-frequency domain.

Moreover, in the present embodiment, an explanation is given for thecase where the RL sequence generation unit 201 converts quantizedfrequency coefficients into one-dimensionalized coefficients using apredetermined scanning method, and generates a sequence (RL sequence)made up of combinations of R indicating the number of consecutive zerocoefficient values and L indicating a non-zero coefficient valuesubsequent to it, but a sequence of the numbers R and a sequence of thecoefficient values L may be generated separately. When a sequence ofcoefficient values L is generated, for example, the reordering unit 202may be omitted, if such sequence is generated by performing scanningstarting at the high-frequency domain toward the low-frequency domainand by selecting the coefficients whose values indicate other than zero.

Furthermore, an explanation is given in the present embodiment for thecase in which probability tables are switched according to thetransition table illustrated in FIG. 17, but different values may begiven for the number of probability tables and for threshold values forthe absolute value of the coefficient value L when probability tablesare switched as illustrated in FIG. 17.

Also, FIG. 21 is presented as an example of a binary table, but anothertable may be employed.

Furthermore, in the present embodiment, an explanation is given for thecase where the arithmetic coding unit performs binary arithmetic coding,however, multi-value arithmetic coding may be performed. In such case,it is possible to omit the binarization unit 203.

(Fourth Embodiment)

The following explains a picture decoding apparatus according to thefourth embodiment of the present invention with reference to thediagrams.

FIG. 19 is a block diagram showing a structure of a decoding apparatus500 b according to the fourth embodiment of the present invention.

This decoding apparatus 500 b performs intra picture decoding on a bitstream resulted from performing intra-picture coding on picture data,and is comprised of a variable length decoding unit 601, an inversequantization unit 602, an inverse frequency transformation unit 603, anda picture memory 604. The bit stream to be inputted here is generatedusing the variable length coding method employed by the coding apparatus100 b according to the third embodiment, and is firstly obtained by thevariable length decoding unit 601.

On the receipt of the bit stream, the variable length decoding unit 601generates a coefficient block made up of a plurality of coefficients asshown in FIG. 15A by performing variable length decoding on such bitstream.

The inverse quantization unit 602, receiving the coefficient block fromthe variable length decoding unit 601, performs inverse quantization onsuch coefficient block. Inverse quantization here means to integrate apredetermined quantization value to each coefficient in the coefficientblock. Generally, a quantization value varies on a coefficient block ora frequency band basis, and is obtained from a bit stream. The inversequantization unit 602 then outputs the inverse-quantized coefficientblock to the inverse frequency transformation unit 603.

The inverse frequency transformation unit 603 performs inverse frequencytransformation on the inverse-quantized coefficient block, and convertsthe coefficient block into a pixel block. Then, the inverse frequencytransformation unit 603 outputs the converted pixel block to the picturememory 604.

The picture memory 604 stores the decoded pixel blocks in sequence, andwhen the pixel blocks equivalent to a picture are stored, it outputsthese pixel blocks as an output picture.

Here, a detailed explanation is given for the variable length decodingunit 601 described above.

FIG. 20 is a block diagram showing an internal structure of the variablelength decoding unit 601.

As shown in FIG. 20, the variable length decoding unit 601 is comprisedof an arithmetic decoding unit 701, a multi-value conversion unit 702, atable storage unit 703, a reordering unit 704, and a coefficientgeneration unit 705.

The table storage unit 703 stores, for example, four probability tables1˜4 as shown in FIG. 18.

On the receipt of the bit stream, the arithmetic decoding unit 701firstly performs arithmetic decoding on the bit stream. Here, anexplanation is given for binary arithmetic decoding to be performed onthe absolute values (binarized ones) of coded coefficient values Lincluded in the bit stream.

When performing arithmetic decoding on the absolute value of the codedcoefficient value L, the arithmetic decoding unit 701 obtains, from themulti-value conversion unit 702, the absolute value of the previouscoefficient value L which has already been decoded and converted into amulti-value. Then, the arithmetic decoding unit 701 switches between theprobability tables 1˜4 stored by the table storage unit 703 in a manneras shown in FIG. 17, depending on the absolute value of such coefficientvalue L, and performs binary arithmetic decoding on the absolute valueof each of the coded coefficient values L so as to output binary datacorresponding to each of them.

The multi-value conversion unit 702 converts the binary data outputtedby the arithmetic decoding unit 701 into multi-values, using, forexample, a binary table as shown in FIG. 21, so as to represent them asthe absolute values of the coefficient values L. Then, the multi-valueconversion unit 702 outputs the absolute values of such coefficientvalues L to the arithmetic decoding unit 701 and the reordering unit704.

An explanation is given for detailed operations of the arithmeticdecoding unit 701 and the multi-value conversion unit 702.

First, the arithmetic decoding unit 701 uses the probability table 1 toperform arithmetic decoding on the absolute value of the first codedcoefficient value L. The arithmetic decoding unit 701 then outputs, tothe multi-value conversion unit 702, the binary data obtained byperforming the arithmetic decoding. The multi-value conversion unit 702uses the binary table so as to convert the binary data into the absolutevalue of the coefficient value L, and outputs the absolute value to thearithmetic decoding unit 701 and the reordering unit 704.

Then, for the absolute values of the subsequent coded coefficient valuesL, the arithmetic decoding unit 701 switches the probability table toanother one for use, depending on the table number of the probabilitytable used when the absolute value of the previous coded coefficientvalue L is binary arithmetic decoded as well as on the absolute value ofsuch previous coefficient value L obtained from the multi-valueconversion unit 702. As shown in FIG. 17, the probability table 2 isused when one of the followings is satisfied: when the probability table1 is used to perform arithmetic decoding on the absolute value of theprevious coded coefficient value L and the absolute value of theprevious coefficient value L obtained form the multi-value conversionunit 702 indicates “1”; and when the probability table 2 is used toperform arithmetic decoding on the absolute value of the previous codedcoefficient value L and the absolute value of the previous coefficientvalue L obtained form the multi-value conversion unit 702 indicates “1”.The probability table 3 is used when one of the followings is satisfied:when the probability table 1 is used to perform arithmetic decoding onthe absolute value of the previous coded coefficient value L and theabsolute value of the previous coefficient value L obtained form themulti-value conversion unit 702 indicates “2”; when the probabilitytable 2 is used to perform arithmetic decoding on the absolute value ofthe previous coded coefficient value L and the absolute value of theprevious coefficient value L obtained form the multi-value conversionunit 702 indicates “2”; and when the probability table 3 is used toperform arithmetic decoding on the absolute value of the previous codedcoefficient value L and the absolute value of the previous coefficientvalue L obtained form the multi-value conversion unit 702 indicates “2or smaller”. And the probability table 4 is used when one of thefollowings is satisfied: when the absolute value of the previouscoefficient value L obtained form the multi-value conversion unit 702indicates “3 or a larger value”; and when the probability table 4 isused to perform arithmetic decoding on the absolute value of theprevious coded coefficient value L. As shown above, the probabilitytables 1˜4 are switched in one direction, that is, from a probabilitytable with a smaller table number to a probability table with a largertable number. Accordingly, even if the absolute value of the previouscoefficient value L obtained from the multi-value conversion unit 702 isequal to or smaller than a predetermined threshold value, theprobability tables shall not be switched in the opposite direction. Thisis the point that distinguishes the present invention from the existingtechnique.

The following explains an example of switching between the probabilitytables, in a case where decoding is performed on the absolute values ofcoefficient values L shown in FIG. 16C.

The arithmetic decoding unit 701 uses the probability table 1 to performarithmetic decoding on the absolute value of the first coded coefficientvalue L (−2) so as to decode it into binary data “01”. Since thearithmetic decoding unit 701 obtains, from the multi-value conversionunit 702, “2” which is a multi-value converted from such binary data“01”, it switches from the probability table 1 to the probability table3 for use. Accordingly, the arithmetic decoding unit 701 uses theprobability table 3 to perform arithmetic decoding on the absolute valueof the second coded coefficient value L (3) so as to decode it intobinary data “001”. Here, since the arithmetic decoding unit 701 obtains,from the multi-value conversion unit 702, “3” which is a multi-valueconverted from such binary data “001”, it switches from the probabilitytable 3 to the probability table 4 for use. Accordingly, the arithmeticdecoding unit 701 uses the probability table 4 to perform arithmeticdecoding on the absolute value of the third coded coefficient value L(6) so as to decode it into binary data “000001”. Here, since theprobability table to be used is switched to the probability table 4, thearithmetic decoding unit 701 uses the probability table 4 to performarithmetic decoding on the absolute values of all the subsequent codedcoefficient values L. For example, the absolute value of the fifth codedcoefficient value L is decoded and converted into a multi-value “2”, butunlike the existing technique, the arithmetic decoding unit 701 uses theprobability table 4 to perform arithmetic decoding on the absolute valueof the sixth coded coefficient value L and thereafter, without switchingto another probability table.

Through the above operation, when the absolute values of coefficientvalues L, the numbers R, and the signs of the coefficient values Lequivalent to one coefficient block are generated, they are inputted tothe reordering unit 704 as an RL sequence.

The reordering unit 704 sorts such inputted RL sequence in reverseorder. However, the number of coefficients shall not be reordered. FIG.16A illustrates a reordered RL sequence. Subsequently, the reorderingunit 704 outputs, to the coefficient generation unit 705, the RLsequence thus reordered.

The coefficient generation unit 705 converts the inputted RL sequenceinto a coefficient block. In so doing, the coefficient generation unit705 makes a conversion from the RL sequence into a coefficient block byrepeatedly carrying out the following operation: generating zerocoefficients for the number indicated by a number R and then generatinga coefficient with a value indicated by a coefficient value L. Here, thecoefficient generation unit 705 performs zigzag scanning starting at thelow-frequency domain toward the high-frequency domain, as shown in FIG.15B, so as to convert the RL sequence shown in FIG. 16A into thecoefficient block shown in FIG. 15A. Then, the coefficient generationunit 705 outputs, to the inverse quantization unit 602, the coefficientblock thus generated.

As described above, in the arithmetic decoding method employed by thevariable length decoding unit 601 in the decoding apparatus 500 baccording to the present invention, a plurality of probability tablesare switched when arithmetic decoding is performed on the absolutevalues of coefficient values L included in an input bit stream. Whenswitching to another probability table, the probability table to be usedfor decoding the absolute value of the next coefficient value L isdetermined depending on the table number of the current probabilitytable and on the absolute value of a coefficient value L resulted fromdecoding. The probability tables are switched only in one direction inthis case, and when the absolute value of the coefficient value Lresulted from decoding exceeds a predetermined value, the sameprobability table is used to perform arithmetic decoding on all thesubsequent absolute values.

As is obvious from the above, the use of the arithmetic decoding methodaccording to the present invention makes it possible to properly decodea bit stream coded with the use of the variable length coding methodaccording to the present invention.

The decoding apparatus according to the present invention has beenexplained in the above using the present embodiment, but the presentinvention is not limited to this.

In the present embodiment, for example, an explanation is provided forthe case where decoding is performed on a bit stream which has beengenerated using intra-picture coding, but the same effects can beachieved also for the case where decoding is performed on a bit streamwhich has been generated using inter-picture coding by performing motioncompensation and others on an input moving picture.

Furthermore, in the present embodiment, an explanation is given for thecase where a bit stream in which picture data is coded being dividedinto pixel blocks, each of which has a size of 4 (horizontal)×4(vertical) pixels, however, a different size may be given for the pixelblock.

Moreover, an explanation is given in the present embodiment for the casewhere four probability tables are used and switched according to thetransition table illustrated in FIG. 17, but different values may beemployed for the number of probability tables and threshold values forthe absolute values of coefficient values L when probability tables areswitched as illustrated in FIG. 17.

Also in the present embodiment, although FIG. 15B is used to explain amethod of performing scanning within a coefficient block, anotherscanning order may also be employed providing that it is the same as thescanning method employed at the time of coding.

Furthermore, an example of a binary table is described with reference toFIG. 21, but another table may be employed providing that it is the sameas the binary table used at the time of coding.

Moreover, although an explanation is given in the present embodiment forthe case where the arithmetic decoding unit 701 performs binaryarithmetic decoding, multi-value arithmetic decoding may be performedinstead. In such case, it is possible to omit the multi-value conversionunit 702.

Subsequently, other embodiments according to the present invention arefurther described with reference to the diagrams.

(Fifth Embodiment)

FIG. 22 is a block diagram showing a functional structure of a codingapparatus 100 c to which the variable length coding method according tothe present invention and the moving picture coding method using it areapplied. In the fifth embodiment, the functional structure for a case ofintra-picture coding an input picture using the moving picture codingmethod of the present invention is described as illustrated for thecoding apparatuses 100 a and 100 b described in the first and thirdembodiments. Also, each unit composing such coding apparatus 100 c canbe realized with a CPU, a ROM for storing in advance a program or dataexecuted by the CPU and a memory for providing a work area in executingthe program as well as for storing temporally the input picture, or thelike.

As shown in FIG. 22, the coding apparatus 100 c according to the fifthembodiment is comprised of the block conversion unit 110, the frequencytransformation unit 120, the quantization unit 130 and a variable lengthcoding unit 160.

Here, the coding apparatus 100 a according to the first embodiment isstructured so that pairs of R and L are coded using a plurality ofvariable length coding tables (VLC tables) and the coding apparatus 100b according to the third embodiment is structured so that L and R arearithmetic-coded separately using a plurality of probability tables.However, the coding apparatus 100 c according to the fifth embodiment isstructured so that L and R are coded separately using a plurality of theVLC tables, which distinguishes the coding apparatus 100 c from thecoding apparatuses 100 a and 100 b. Therefore, the coding apparatus 100c includes the variable length coding unit 160 instead of the variablelength coding units 140 and 150 in the coding apparatuses 100 a and 100b. As for other components, the descriptions are abbreviated since theyare the same as those described for the coding apparatuses 100 a and 100b, and the variable length coding unit 160 is described in detail.

The variable length coding unit 160 generates an L sequence and an Rsequence based on the frequency coefficients quantized by thequantization unit 130 and then generates a bit stream of absolute valuesof coefficients |L|, or the like, using a one-dimensional VLC switchingmethod.

FIG. 23 is a block diagram showing in detail a functional structure ofthe variable length coding unit 160.

As shown in FIG. 23, the variable length coding unit 160 is comprised ofan RL sequence generation unit 161, a code assignment unit 163 and atable storage unit 164.

The RL sequence generation unit 161 generates the R sequence and the Lsequence separately by performing zigzag scanning on the quantizedfrequency coefficients (simply to be referred to as “coefficients”hereinafter) starting at the low-frequency domain toward thehigh-frequency domain.

To be more precise, when the coefficients in the block shown in FIG. 3Aare inputted, the RL sequence generation unit 161 performs zigzagscanning as shown in FIG. 3B. The RL sequence generation unit 161 thenobtains firstly, for the L sequence, m indicating the number of non-zerocoefficient values L, a sequence of absolute values of such coefficients|L| and a sequence of signs for such coefficients, as shown in FIG. 24A.This is because L does not depend on R and can be obtained independentlywhile R depends on L. Subsequently, the RL sequence generation unit 161generates a sequence of R (R sequence) as shown in FIG. 24B.

The table storage unit 164 stores a plurality of VLC tables (e.g., 8) of1641 a˜1641 g for performing variable length coding on each absolutevalue of the coefficients |L| in the L sequence, a plurality ofthreshold values for the absolute value of the coefficient |L|, and athreshold value table 1642 for switching adaptively between the VLCtables 1641 a˜1641 g according to the absolute value of the coefficient|L|.

FIG. 25 is a diagram showing structural examples for the VLC tables 1641a˜1641 g. Each of the VLC tables 1641 a˜1641 g actually correlatesabsolute values of the coefficients |L| and binary codes, which is shownin a single table in the diagram.

Here, a smaller code number is assigned to the absolute value of thecoefficient |L| as an apparition frequency of the absolute value of thecoefficient |L| gets higher, and generally, the smaller the absolutevalue of the coefficient |L| is, the higher the apparition frequencybecomes. This is because the largest value of the absolute value of thecoefficient |L| disperses, whether in a video or on a screen, so thatthe apparition frequency of the same value is low whereas the smallestvalue of the absolute value of the coefficient |L|, namely, ahigh-frequency component, has a strong tendency to indicate “1” and “2”,and thereby the apparition frequency of the same value becomes higher.On the other hand, using only the absolute value of the coefficient |L|,the binary code and the VLC table, which are mutually correlated, makesthe code length very long as the absolute value of the coefficient |L|becomes larger. Therefore, the VLC tables 1641 a˜1641 g to be applied todepending on the absolute value of the coefficient |L| are prepared inadvance so that the code length does not become longer even when theabsolute value of the coefficient |L| becomes larger.

Each of the VLC tables 1641 a˜1641 g has a different rate of change incode length for coefficients: a code length for the smallest value ofthe coefficient gets longer in an ascending order of the number kassigned to each of the tables and a code length for the largest valueof the coefficient gets shorter in the ascending order of the number k.

To be more specific, the VLC table 1641 a is a table in which a codelength is the shortest when the absolute value of the coefficient |L| issmall and a code length is the longest when the absolute value of thecoefficient |L| is large. Namely, the VLC table 1641 a, out of the VLCtable 1641 a˜1641 g, is a table in which the rate of change in codelength for absolute values of the coefficients |L| is the largest, andis suitable for the case in which the absolute value of the coefficient|L| is small (e.g., “1”˜“3”).

The variable length table 1641 g is a table in which a code length isthe longest when the absolute value of the coefficient |L| is large anda code length is the shortest when the absolute value of the coefficient|L| is large. Namely, the VLC table 1641 g, out of the VLC tables 1641a˜1641 g, is a table in which the rate of change in code length forabsolute values of the coefficients |L| is the smallest, and is suitablefor the case in which the absolute value of the coefficient |L| is large(e.g., “193”).

The VLC tables 1641 b˜1641 f are the tables in which the code lengthgradually gets longer as the absolute value of the coefficient |L|become smaller and gradually gets shorter as the absolute value of thecoefficient |L| become larger, in an ascending order from 1641 b to 1641f. Namely, the VLC tables 1641 b˜1641 f are the tables in which the rateof change in code length for absolute values of the coefficients |L|gradually gets smaller. The VLC table 1641 b is suitable to be used whenthe absolute value of the coefficient |L| is, for example, between “4”and “6” whereas the VLC table 1641 c is suitable to be used when theabsolute value of the coefficient |L| is, for example, between “7” and“12”.

Thus, it is possible to improve the coding efficiency since the variablelength code with the code length based on the coefficient can be adaptedto each table. In other words, it is possible to shorten the code lengthremarkably by switching between the tables depending on the coefficientso that the coefficient may be coded into the variable length code whosecode length is shorter at one table than the other table when thecoefficient is small and the coefficient may be coded into the variablelength code whose code length is shorter at one table than the otherwhen the coefficient is large. Moreover, the improvement of codingefficiency can be realized since a range in which the code length getsshorter can be assigned to each of the tables. The coding does not usearithmetic coding but a VLC method, therefore, complicated processingrequired of arithmetic coding is unnecessary, and the variable lengthcoding is performed easily by referring to a table once the table isdetermined for coding.

FIG. 26 is a diagram showing a structural example of the threshold valuetable 1642.

The threshold value table 1642 is set beforehand according to thecharacteristics of the VLC tables 1641 a˜1641 g and keeps a plurality ofthreshold values to be used for switching between the VLC tables 1641a˜1641 f. For example, the threshold values are set respectively asfollows: “4” for the switching between the VLC tables 1641 a and 1641 b,“7” for the switching between the VLC tables 1641 b and 1641 c, . . .and “193” for the switching between the VLC tables 1641 f and 1641 g.Thus, the timing for switching between the tables can be predictedeasily, therefore, it is possible to switch to the optimal tableaccording to the absolute value of the coefficient |L|.

The code assignment unit 163 performs variable length coding on theabsolute values of the coefficients |L| outputted from the RL sequencegeneration unit 161, separately from the R sequence, using the VLCtables 1641 a˜1641 g as well as the threshold value table 1642 stored inthe table storage unit 164 and then assigns binary codes to them. To putit shortly, the code assignment unit 163 one-dimentionalizes theabsolute values of the coefficients |L|.

The following describes a coding operation performed by the codingapparatus 100 c. The operations performed by the block conversion unit110˜the quantization unit 130 are abbreviated as they are the same asthose described for the coding apparatuses 100 a and 100 b, and thevariable length coding operated by the variable length coding unit 160is explained in detail.

The frequency coefficients quantized by the quantization unit 130 areinputted to the RL sequence generation unit 161 in the variable lengthcoding apparatus 160.

The RL sequence generation unit 161, as in FIG. 3B, firstlyone-dimensionalizes the quantized frequency coefficients in the block byperforming zigzag scanning on them starting at the domain of directcurrent components toward that of high-frequency components. The RLsequence generation unit 161 then generates separately a sequence of“L”s, each of which indicates a non-zero coefficient (to be referred toas “L sequence” hereinafter) and a sequence of “R”s, each of whichindicates the number of consecutive zero coefficients (to be referred toas “R sequence” hereinafter). FIGS. 24A and 24B show examples of thegenerated L sequence and R sequence. As for the L sequence, it can bedivided into the number of coefficients m, absolute values of thecoefficients |L| and signs of the coefficients. Regarding the signs ofthe coefficients, “0” indicates that the coefficient is positive whereas“1” indicates that the coefficient is negative.

Here, the coefficient of the L sequence nears to “1” by scanning fromthe low-frequency domain toward the high-frequency domain since thecoefficient of the high frequency component generally tends to become“0”.

The code assignment unit 163 codes each L value in the L sequencegenerated by the RL sequence generation unit 161 in an order opposite tothe order used for zigzag scanning, that is, starting from the highfrequency coefficients. Namely, the code assignment unit 163 obtains insequence Huffman codes (variable length codes) corresponding to theabsolute values of the coefficients |L| starting from the end of the Lsequence, using the VLC tables 1641 a˜1641 g.

The reason for coding the L value in an order reverse to the order usedfor zigzag scanning is that non-zero coefficients in the high-frequencydomain converge on a periphery of the coefficient “1”, and it is easy todetermine the first table for coding, to generate the VLC tables 1641a˜1641 g and to determine the threshold values.

The code assignment unit 163 assigns the variable length codes to “L”sin the L sequence and “R”s in the R sequence using various tables storedin the table storage unit 164. The code assignment unit 163 also assignsa variable length code to the number of coefficients m, but processingof assigning the variable length codes to the absolute values of thecoefficients |L| is described here.

FIG. 27 is a flowchart showing processing of assigning the variablelength codes operated by the code assignment unit 163.

The code assignment unit 163 sets the number of coefficients m outputtedfrom the RL sequence generation unit 161 as a start for coding of thecoefficients (absolute values of the coefficients |L|) in the block(S101). Then, the code assignment unit 163 sets “0” for the table numberk as an initial value of the VLC table to be used for reference (S102),refers to the threshold value table 1642 and sets a threshold value to“4” (S103).

When the settings of the number of coefficients m, the referential VLCtable (VLC table 1641 a in this case) and the threshold value areterminated, the code assignment unit 163 reads out the absolute value ofthe coefficient |L|, which is outputted by the RL sequence generationunit 161, starting from the last (S104) and codes the read-out absolutevalue of the coefficient |L| into a variable length code using the VLCtable with the number set beforehand (S105). Then, when the coding isover, the code assignment unit 163 stores the binary code obtained bythe coding in a buffer (e.g., FILO buffer) that is not shown in thediagram (S106), decrements the number of coefficients m by “1” (S107)and judges whether the decremented number m indicates “0” or not,namely, whether all the coefficients included in the L sequence arecoded or not (S108).

When the number of coefficients m does not indicate “0” (No in S108), itis judged whether or not the absolute value of the immediately precedingcoefficient has exceeded the threshold value (S109). When it does notexceed the threshold value (No in S109), the code assignment unit 163reads out the absolute value of the next coefficient |L|, starting fromthe last (S104), and executes Steps S105 S108, or the like. Namely, thecode assignment unit 163 codes the absolute value of the nextcoefficient using the same VLC table as used for the previouscoefficient.

When the absolute value of the immediately preceding coefficient |L| hasexceeded the threshold value (No in S109), the code assignment unit 163increments the table number k by “1” (S110). Thus, in coding theabsolute value of the next coefficient |L|, the VLC table with low rateof change in code length, which is applicable to the coding of theabsolute value of the coefficient |L| whose code length is long, isreferred to (for instance, the VLC table 1641 b with k=1 is referred towhen the previous VLC table is 1641 a with k=0).

When the increment for the table number k is terminated, the codeassignment unit 163 refers to the threshold value table 1642 and updatesit to the next threshold value (e.g. “7” when the previous thresholdvalue is “4”) (S111). Thus, the table can be switched to the next VLCtable with a low rate of change in code length, which is applicable tothe coding of the absolute value of the coefficient |L| whose codelength is long, only when the absolute value of the coefficient |L| hasexceeded the new threshold value.

More precisely, when the absolute value of the previous coefficient |L|has exceeded the threshold value “4” assigned to the switching betweenthe VLC tables 1641 a with the table number “0” and 1641 b with thetable number “1”, the reference is switched from the VLC table 1641 a tothe VLC table 1641 b for coding the absolute value of the nextcoefficient, and the threshold value is set to “7”, as shown in FIG. 28.

Similarly, when the absolute value of the previous coefficient |L| hasexceeded the threshold value “7”˜“193” between the VLC table 1641 b withthe table number “1” and the VLC table 1641 g with the table number “6”,the reference for coding the absolute value of the next coefficient |L|is switched sequentially from the VLC table 1641 b with the table number“1” to the VLC table 1641 c with the table number “2”, . . . and to theVLC table 1641 g. This is shown in FIG. 28.

Here, a direction of switching between the tables is one-directional anddoes not go back. Thus, the frequent switching of the tables dependingon the coefficient can be prevented and thereby the number of timesswitching between the tables can be reduced. For example, since the workarea in the memory is limited in space, only the table to be used isstored. In this case, it takes time to start coding the next coefficientsince it takes time to read out the next table from the ROM and expandit in the work area each time the table is switched. Switchingone-directionally in this way between the tables is effective inlimiting the number of times switching between the tables and inabbreviating the total time necessary for coding the next coefficient.

When the increment of the table number and the update of the thresholdvalue as such are terminated, the code assignment unit 163 reads out theabsolute value of the next coefficient |L|, starting from the last(S104) and executes Steps S105˜S108, or the like. Namely, the coding isperformed using the VLC table suitable for the case where the absolutevalue of the coefficient |L| is larger than the one before.

Such processing is executed repeatedly until the number of coefficientsm indicate “0”, which is the time when the coding of the absolute valuesof the coefficients |L| in the current block ends.

To be more concrete, when the sequence of the absolute values of thecoefficients |L| in the block are “1”, “1”, “2”, “3”, “4”, “12”, “2”,“3”, “31”, “22”, “5”, “9” and “38”, starting from the end of thesequence, the code assignment unit 163 codes them respectively intobinary codes “1”, “1”, “010”, “011”, “00100” and “0001100” in this orderusing firstly the VLC table 1641 a. The code assignment unit 163 thenswitches the table for coding to the VLC table 1641 b with the tablenumber k=1 since the threshold value “4” is exceeded when the absolutevalue of the coefficient |L| indicating “12” is coded.

The code assignment unit 163 then codes respectively the absolute valueof the next coefficient |L| indicating “2”, “3” and “31” into binarycodes “11”, “0100” and “0000100000” with the use of the VLC table 1641 bto which the table is switched. The code assignment unit 163 thenswitches the table for coding to the VLC table 1641 c with the tablenumber k=2 since the threshold value “7” is exceeded in coding theabsolute value of the coefficient |L| indicating “31”.

Furthermore, the code assignment unit 163 codes the absolute value ofthe next coefficient into a binary code “0011001” using the VLC table1641 c to which the table is switched. The code assignment unit 163 thenswitches the table for coding to the VLC table 1641 d with the tablenumber k=3 since the threshold value “13” is exceeded in coding theabsolute value of the coefficient |L| indicating “22”.

The code assignment unit 163 then codes respectively the absolute valuesof the following coefficients |L| indicating “5”, “9” and “38” intobinary codes “1100”, “010000” and “00101101” using the VLC table 1641 dto which the table is switched.

Consequently, the binary code“1101001100100000110011010000001000000011001110001000000101101” isstored in the buffer.

The number of coefficients in the L sequence, m, the binary codes of theabsolute values of the coefficients |L|, the signs of the coefficientsand the binary codes of the R values in the R sequence, which are coded,are also stored in the buffer and transmitted to the decoding apparatusvia a recording medium like a CD, and a transmission medium such as anInternet, a satellite broadcasting, or the like.

Here, when it is assumed that the absolute values of the coefficients inthe L sequence, “1”, “1”, “2”, “3”, “4”, “12”, “2”, “3”, “31”, “22”,“5”, “9” and “38” are coded using only the VLC table 1641 a, the binarycodes are “1”, “1”, “010”, “011”, “00100”, “0001100”, “010”, “011”“010”, “011”, “000011111”, “000010110”, “00101”, “001001” and“00000100110”, of which the code length amounts to 64 bits.

In contrast, by using the coding method according to the fifthembodiment, it is possible to improve coding efficiency even when thelargest value of the absolute value of the coefficient |L| in the blockis relatively small and the absolute value of the coefficient |L| doesnot increase gradually since the code length amounts to 61 bits. Thisascribes greatly to the fact that when the absolute value of thecoefficient |L| indicates, for instance, “22” and “38”, it requires 9bits of “000010110” and 11 bits of “00000100110” using only the VLCtable 1641 a for the coding whereas it only requires 7 bits of “0011001”and 8 bits of “00101101” using the present method. Therefore, it ispossible to improve the coding efficiency remarkably when the largestvalue of the coefficient |L| in the normal block is relatively high andthe absolute value of the coefficient |L| increases gradually.

In the fifth embodiment, when the absolute value of the immediatelypreceding coefficient |L| has exceeded the threshold value (Yes inS109), the table number k is incremented by “1” (S110) and the coding isperformed using the VLC table with the next number (see reference toFIG. 28). However, the table may be skipped to the VLC table adapted tothe absolute value of the coefficient |L| depending on the absolutevalue of the immediately preceding coefficient |L| which has exceededthe threshold value. Namely, when the absolute value of the immediatelypreceding coefficient |L| to be coded with reference to the table withthe number k=1 is “20”, for instance, there is a high possibility thatthe absolute value of the next coefficient |L| is greater than “20”,therefore, the table with the number k=3 can be used as reference forcoding the absolute value of the next coefficient |L|. In this case, thethreshold value may be set to the one corresponding to the VLC table(e.g., 25).

It is explained that eight VLC tables are used, but the number of VLCtables can be either between 2˜7 or greater than eight, using aplurality of threshold values, and the VLC table may be switched eachtime each threshold value is exceeded.

Also, in the fifth embodiment, the absolute value and the sign of thecoefficient are coded separately and each VLC table for absolute valuesof coefficients contains no signs (absolute values), however, thecoefficients with the signs may be coded. In this case, the binary codesmay include the signs. For instance, 1 bit for the sign may be added toan LSB bit for the variable length code.

In the fifth embodiment, the case in which a picture is coded by meansof intra-picture coding is described, however, the same effects can beobtained for the case in which a picture is coded by means ofinter-picture coding by performing motion compensation and others on aninput moving picture, using the method according to the presentembodiment.

Also, the fifth embodiment describes the case of dividing the inputpicture into blocks, each of which is sized 4 (horizontal)×4 (vertical)pixels, however, a different size can be given for the size of theblock.

The fifth embodiment describes a method of scanning a block withreference to FIG. 3B, however, different scanning method can be employedproviding that the scanning is performed from the low-frequency domaintoward the high-frequency domain.

Also, an example of the VLC table is described with reference to FIG.25, however, it may be a different table.

The fifth embodiment describes the case of adding the number of L valuesto the beginning of the L sequence, however, the EOB may be attached tothe end of the L sequence.

(Sixth Embodiment)

FIG. 30 is a block diagram showing a functional structure of a decodingapparatus to which the variable length decoding method and the movingpicture decoding method using it according to the embodiment of thepresent invention are applied. Here, the bit stream generated using thevariable length coding method of the present invention described in thefifth embodiment shall be used.

As shown in FIG. 30, the decoding apparatus 500 c is comprised of avariable length decoding unit 560, an inverse quantization unit 520, aninverse frequency transformation unit 530 and a picture memory 540. Eachunit composing such decoding apparatus 500 c can be realized with a CPU,a ROM for storing in advance a program or data executed by the CPU and amemory for providing a work area when the program is executed as well asfor storing temporally an input bit stream, or the like. As for theinverse quantization unit 520, the inverse frequency transformation unit530 and the picture memory 540, the structures are the same as thosedescribed for the decoding apparatuses 500 a and 500 b, therefore thedescriptions are abbreviated, and the structure of the variable lengthdecoding unit 560 is explained in detail.

The variable length decoding unit 560 is comprised of a code conversionunit 561, a table storage unit 562 and a coefficient generation unit564.

The table storage unit 562 stores in advance a plurality of VLC tables5621 a˜5621 g correlating variable length codes with absolute values ofa coefficients |L| as well as a threshold value table 5622, or the like.The VLC tables 5621 a˜5621 g are constructed in the same manner as theVLC tables 1641 a˜1641 g shown in FIG. 25 and the threshold value table5622 is constructed in the same manner as the threshold value table 1642shown in FIG. 26.

The code conversion unit 561 performs conversion on an inputted bitstream so that the variable length codes are converted into the numberof coefficients in L sequence m, the absolute values of the coefficients|L| and the R values in the R sequence, using the tables stored in thetable storage unit 562 (the VLC tables 5621 a˜5621 g and the thresholdvalue table 5622, and the like). The VLC tables 5621 a˜5621 g are usedfor the conversion of the absolute values of the coefficients |L|.

The coefficient generation unit 564 converts the RL values intocoefficients based on the inputted L sequence and R sequence andtwo-dimensionalizes them using a predetermined scanning method. Whenconverting the RL sequence into coefficients, a coefficient “0” isgenerated for the number indicated by R based on a predeterminedscanning order, then, the coefficient indicated by L is generated. Here,assuming that the coefficients are scanned in zigzags starting at thelow-frequency domain toward the high-frequency domain, the RL sequenceis converted into a coefficient block shown in FIG. 11. The generatedcoefficient block is inputted to the inverse quantization unit 520.

The following describes decoding operations at each unit in the variablelength decoding unit 560.

Here, it is described with an assumption that the codes of the binarycode input bit stream inputted by the code conversion unit 561 are “1”,“1”, “101”, “011”, “00100”, “0001100”, “11”, “0100”, “0000100000”,“0011001”, “1100”, “010000” and “00101101” in sequence starting from thehead.

The code conversion unit 561, as a start for decoding the variablelength codes, decodes the number of coefficients m outputted from thecoding apparatus 100 c and sets the decoded number of coefficient m. Thecode conversion unit 561 then sets a table number k to “0” as an initialvalue of a reference VLC table. Then, the code assignment unit 163refers to the threshold value table 5622 and sets a threshold value to“4” (S103). After the number of coefficients m, the reference VLC table(VLC table 5621 a in this case) and the threshold value are set, thecode conversion unit 561 reads out sequentially the absolute values ofthe coefficients |L| from the head (namely, from those in thehigh-frequency domain) in an order in which they are outputted from thecoding apparatus 100 c and performs variable length decoding on theread-out variable length codes into the absolute values of thecoefficients |L| using the VLC table with the set number. After thedecoding of each variable length code, the code conversion unit 561stores the absolute value of the coefficient |L| obtained in thedecoding into a buffer that is not shown in the diagram (e.g. FILObuffer), decrements the number of coefficients m by “1” and judgeswhether or not the number m indicates “0” after the decrement, that is,whether or not all the coefficients included in the L sequence aredecoded.

When the number of coefficients m does not indicate “0”, it is judgedwhether or not the absolute value of the immediately precedingcoefficient |L| that is variable length decoded has exceeded thethreshold value. When it has not exceeded the threshold value, the codeconversion unit 561 reads out the next variable length code from the endand decodes it as an absolute value of the coefficient |L| using thesame table used for the one before.

When the absolute value of the immediately preceding coefficient |L|that is variable length decoded has exceeded the threshold value, thecode conversion unit 561 increments the table number k by “1”. Thus, incoding the absolute value of the next coefficient |L|, the VLC tablewith low rate of change in code length, which is applicable to thecoding of the absolute value of the coefficient |L| whose code length islong (for instance, the VLC table 5621 b is referred to when theprevious VLC table is 5621 a), is referred to. When the increment forthe table number k is terminated, the code conversion unit 561 refers tothe threshold value table 5622 and updates it to the next thresholdvalue (e.g. “7” when the previous threshold value is “4”). Thus, thetable can be switched to the next VLC table with low rate of change incode length, which is applicable to the coding of the absolute value ofthe coefficient |L| whose code length is long, only when the absolutevalue of the coefficient |L| has exceeded the new threshold value.

To be more concrete, the VLC table 5621 a with the table number k=0 isreferred to for the first variable length code. Now, assume that the VLCtable 5621 a is referred to, the variable length code that correspondsto the input bit stream is “1” and the absolute value of the coefficient|L| in this case is “1”. Similarly, in proceeding sequentially theconversion of variable length codes into absolute values of thecoefficients |L| using the VLC table 5621 a, the variable length codesare converted into the absolute values of the coefficients |L| asfollows: the variable length code “1” into the absolute value of thecoefficient |L| “1”; the variable length code “010” into the absolutevalue of the coefficient |L| “3”; the variable length code “00100” intothe absolute value of the coefficient “4”; and the variable length code“0001100” into the absolute value of the coefficient |L| “12”.

Here, assuming that the threshold value for the absolute value of thecoefficient |L| is “4”, the absolute value of the coefficient |L|exceeds the threshold value when the sixth variable length code isconverted. Therefore, the code conversion unit 561 uses the next VLCtable 5621 b with the number k=1 for the conversion of the subsequentabsolute values of the coefficients |L|, sets the threshold value to “7”and converts them into the absolute values of the coefficients |L|.Consequently, the seventh variable length code “11” is converted intothe absolute value of the coefficient |L| “2”.

The eighth variable length code “0100” is converted into the absolutevalue of the coefficient |L| “3” whereas the ninth variable length code“000010000” is converted into the absolute value of the coefficient |L|“31”. Assuming here that the threshold value for the absolute value ofthe coefficient |L| is “7”, the absolute value of the coefficient |L|exceeds the threshold value at the ninth absolute value of thecoefficient |L| “31”. Therefore, the code conversion unit 561 uses theVLC table 5621 b with the table number k=2 for the conversion of thesubsequent absolute values of the coefficients |L|, sets the thresholdvalue to “13” and converts them into the absolute values of thecoefficients |L|. Meanwhile, even when the absolute value of thecoefficient |L| obtained in the decoding into the seventh absolute valueof the coefficient |L| goes below the threshold value “7”, the table isnot switched back to the VLC table 5621 a and performs the conversionusing the VLC table 5621 b.

With the repetition of the above processing, the absolute values of thecoefficients |L| equivalent to a single block (“m” coefficients) aregenerated and they are reordered reversely using first-in later-outoperated by the FILO buffer. The signs are also reordered reverselyusing first-in later-out operated by the FILO buffer. However, thenumber shall not be reordered. It is assumed here that the sequence isgenerated in the same order as used for the L sequence shown in FIG. 24A(namely, an order starting at the low frequency domain toward the highfrequency domain).

Each of the absolute values of the coefficients |L| in the L sequencethus reordered is inputted to the coefficient generation unit 564. Thecode conversion unit 561 decodes each R value in the R sequence usingthe same processing as used for the absolute values of the coefficients|L| and outputs the R sequence shown in FIG. 24A to the coefficientgeneration unit 564.

The coefficient generation unit 564 converts the RL sequence intocoefficients based on the inputted L sequence and R sequence. In sodoing, the coefficient generation unit 564 performs the conversion ofthe RL sequence into coefficients by repeatedly carrying out thefollowing operation: generating a coefficient “0” for the numberindicated by R and then generating the coefficient for the valueindicated by L by adding the signs. Here, assume that the scanning isperformed in zigzags starting at the low-frequency domain toward thehigh-frequency domain, the R sequence shown in FIG. 24A and the Lsequence shown in FIG. 24B are converted into a coefficient block. Thegenerated coefficient block is inputted to the inverse quantization unit520.

As described above, in the variable length decoding method according tothe sixth embodiment, firstly in the decoding step, a plurality ofvariable length coding (decoding) tables to be used for decoding areswitched in one direction, the variable length codes in the bit streamare decoded into non-zero coefficients according to a frequency domainin a predetermined order, using the VLC table to which the table isswitched. Subsequently, in the coefficient conversion step, the non-zerocoefficients are converted into coefficients in a block based on thegenerated coefficients. Here, each of the tables has a different rate ofchange in code length for coefficients so that a code length of thesmallest coefficient gets longer as the number assigned to the tablebecomes larger and a code length of the largest coefficient gets shorteras the table number becomes larger. The threshold value is set based onthe adaptability of each table in which a code length corresponding to acoefficient is shorter than the other table. The variable length codesin the bit stream are ranged in an order starting from thehigh-frequency components toward the low-frequency components. In thedecoding step, the variable length codes are decoded into coefficientsaccording to the order in which the bit stream is composed of, asequence of coefficients is generated by outputting the decodedcoefficients in an order starting from the end of the bit stream. In thecoefficient generation step, the coefficients are scanned according tothe order in which the sequence of coefficients is composed of.

In the coding step, when the absolute value of the decoded coefficientexceeds the threshold value, the next variable length code is decodedinto a coefficient by switching the table used for decoding currentvariable length code to be decoded to a table whose number is largerthan the one assigned to the present table.

With the above processing, the bit stream that is coded using thevariable length coding method according to the present invention can beproperly decoded by using the variable length decoding method accordingto the present invention.

In the sixth embodiment, it is assumed that when the absolute value ofthe immediately preceding decoded coefficient |L| exceeds the thresholdvalue, the table number k is incremented by “1” and the decoding isperformed using the VLC table with the next number, as in the fifthembodiment. However, the table may be skipped to the one adapted to theabsolute value of the coefficient |L| according to the absolute value ofthe immediately preceding coefficient which has exceeded the thresholdvalue, under the condition that the method of switching between thetables is the same as the one used for coding. In this case, thethreshold value can be set to the one corresponding to the VLC table.

In the sixth embodiment, an example of the VLC table is described withreference to FIG. 25, but a different table may be used providing thatit is the one used for coding. Also, the case of using eight VLC tablesis described, but the number of the tables can be between two and six ormore than eight, using a plurality of threshold values, and the VLCtables can be switched each time each of the threshold values isexceeded. However, the structure of the VLC table and the thresholdvalue here shall be the same as those used for coding.

Also, in the sixth embodiment, the absolute value and the sign of thecoefficient are coded separately and each VLC table for absolute valuesof coefficients contains no signs (absolute values), however, thecoefficients with the signs may be coded. In this case, the binary codesmay include the signs. For instance, 1 bit may be added for the sign toan LSB bit for the variable length code.

Also, in the sixth embodiment, the VLC table is switched when the valueL has exceeded the threshold value. A VLC table with a large number maybe used for decoding the absolute values of the coefficients |L| in adescending order (namely, starting from those in the high frequencydomain) and may be switched to a VLC table with a small number when theabsolute value of the decoded coefficient |L| goes below the thresholdvalue

In the sixth embodiment, the case in which a picture is coded by meansof intra-picture coding is described, however, the same effects can beobtained for the case in which a picture is coded by means ofinter-picture coding by performing motion compensation and others on aninput moving picture, using the method according to the presentembodiment.

Also, the sixth embodiment describes the case of dividing the inputpicture into blocks, each of which is sized 4 (horizontal)×4 (vertical)pixels, however, a different size may be given for the size of theblock.

The sixth embodiment describes a method of scanning a block withreference to FIG. 11, however, a different scanning order can be usedproviding that it is the same as the one used for coding.

(Seventh Embodiment)

The following describes an example of realizing the variable lengthcoding method, variable length decoding method, a variable length codingapparatus, the variable length decoding apparatus, the moving picturecoding method, the moving picture decoding method, the moving picturecoding apparatus and the moving picture decoding apparatus according tothe present invention in another embodiment.

It is possible to perform the processing described in each of the aboveembodiments in an independent compute system by recording a program forrealizing the structures of the coding apparatus or the decodingapparatus shown in each of the above embodiments in a recording mediumsuch as a flexible disk or the like.

FIG. 32 is an illustration for carrying out the moving picture codingmethod described in the first, third and fifth embodiments or the movingpicture decoding method described in the second, fourth and sixthembodiments in the computer system using the program recorded onto theflexible disk on which the program is recorded.

FIG. 32B shows a full appearance of a flexible disk, its structure atcross section and the flexible disk itself whereas FIG. 32A shows anexample of a physical format of the flexible disk as a main body of astorage medium. A flexible disk FD is contained in a case F with aplurality of tracks Tr formed concentrically from the periphery to theinside on the surface of the disk, and each track is divided into 16sectors Se in the angular direction. Thus, the program is stored in anarea assigned for it on the flexible disk FD.

FIG. 32C shows a structure for recording and reading the program on theflexible disk FD. When the program is recorded on the flexible disk FD,the computer system Cs writes in the program via a flexible disk drive.When the coding apparatus and the decoding apparatus are constructed inthe computer system using the program on the flexible disk, the programis read out from the flexible disk and then transferred to the computersystem by the flexible disk drive.

The above explanation is made on an assumption that a storage medium isa flexible disk, but the same processing can also be performed using anoptical disk. In addition, the storage medium is not limited to aflexible disk and an optical disk, but any other medium such as an ICcard and a ROM cassette capable of recording a program can be used.

The following is a description for the applications of the picturecoding/decoding method illustrated in the above-mentioned embodiment anda system using them.

FIG. 33 is a block diagram showing an overall configuration of a contentsupply system ex100 for realizing content delivery service. The area forproviding communication service is divided into cells of desired size,and cell sites ex107˜ex110, which are fixed wireless stations, areplaced in respective cells.

This content supply system ex100 is connected to apparatuses such as acomputer ex111, a PDA (Personal Digital Assistant) ex112, a cameraex113, a cell phone ex114 and a cell phone with a camera ex115 via, forexample, Internet ex101, an Internet service provider ex102, a telephonenetwork ex104, as well as the cell sites ex107˜ex110.

However, the content supply system ex100 is not limited to theconfiguration shown in FIG. 33 and may be connected to a combination ofany of them. Also, each apparatus may be connected directly to thetelephone network ex104, not through the cell sites ex107˜ex110.

The camera ex113 is an apparatus capable of shooting video such as adigital video camera. The cell phone ex114 may be a cell phone of any ofthe following system: a PDC (Personal Digital Communications) system, aCDMA (Code Division Multiple Access) system, a W-CDMA (Wideband-CodeDivision Multiple Access) system or a GSM (Global System for MobileCommunications) system, a PHS (Personal Handyphone System) or the like.

A streaming server ex103 is connected to the camera ex113 via thetelephone network ex104 and also the cell site ex109, which realizes alive distribution or the like using the camera ex113 based on the codeddata transmitted from the user. Either of the camera ex113, the serverwhich transmits the data and the like may code the data. The movingpicture data shot by a camera ex116 may be transmitted to the streamingserver ex103 via the computer ex111. In this case, either the cameraex116 or the computer ex111 may code the moving picture data. An LSIex117 included in the computer ex111 and the camera ex116 performs thecoding processing. Software for coding and decoding pictures may beintegrated into any type of storage medium (such as a CD-ROM, a flexibledisk and a hard disk) that is a recording medium which is readable bythe computer ex111 or the like. Furthermore, a cell phone with a cameraex115 may transmit the moving picture data. This moving picture data isthe data coded by the LSI included in the cell phone ex115.

The content supply system ex100 codes contents (such as a music livevideo) shot by a user using the camera ex113, the camera ex116 or thelike in the same way as shown in the above-mentioned embodiment andtransmits them to the streaming server ex103, while the streaming serverex103 makes stream delivery of the content data to the clients at theirrequests. The clients include the computer ex111, the PDA ex112, thecamera ex113, the cell phone ex114 and so on capable of decoding theabove-mentioned coded data. In the content supply system ex100, theclients can thus receive and reproduce the coded data, and can furtherreceive, decode and reproduce the data in real time so as to realizepersonal broadcasting.

When each apparatus in this system performs coding or decoding, thepicture coding apparatus or the picture decoding apparatus shown in theabove-mentioned embodiment can be used.

A cell phone will be explained as an example of such apparatus.

FIG. 34 is a diagram showing the cell phone ex115 using the picturecoding/decoding method explained in the above-mentioned embodiments. Thecell phone ex115 has an antenna ex201 for communicating with the cellsite ex110 via radio waves, a camera unit ex203 such as a CCD cameracapable of shooting moving and still pictures, a display unit ex202 suchas a liquid crystal display for displaying the data such as decodedpictures and the like shot by the camera unit ex203 or received by theantenna ex201, a body unit including a set of operation keys ex204, anvoice output unit ex208 such as a speaker for outputting voice, an voiceinput unit ex205 such as a microphone for inputting voice, a storagemedium ex207 for storing coded or decoded data such as data of moving orstill pictures shot by the camera, data of received e-mails and that ofmoving or still pictures, and a slot unit ex206 for attaching thestorage medium ex207 to the cell phone ex115. The storage medium ex207stores in itself a flash memory element, a kind of EEPROM (ElectricallyErasable and Programmable Read Only Memory) that is a nonvolatile memoryelectrically erasable from and rewritable to a plastic case such as anSD card.

Next, the cell phone ex115 will be explained with reference to FIG. 35.In the cell phone ex115, a main control unit ex311, designed in order tocontrol overall each unit of the main body which contains the displayunit ex202 as well as the operation keys ex204, is connected mutually toa power supply circuit unit ex310, an operation input control unitex304, a picture coding unit ex312, a camera interface unit ex303, anLCD (Liquid Crystal Display) control unit ex302, a picture decoding unitex309, a multiplexing/demultiplexing unit ex308, a read/write unitex307, a modem circuit unit ex306 and an voice processing unit ex305 viaa synchronous bus ex313.

When a call-end key or a power key is turned ON by a user's operation,the power supply circuit unit ex310 supplies the respective units withpower from a battery pack so as to activate the digital cell phone witha camera ex115 as a ready state.

In the cell phone ex115, the voice processing unit ex305 converts thevoice signals received by the voice input unit ex205 in conversationmode into digital voice data under the control of the main control unitex311 including a CPU, ROM and RAM, the modem circuit unit ex306performs spread spectrum processing on the digital voice data, and thecommunication circuit unit ex301 performs digital-to-analog conversionand frequency transformation on the data, so as to transmit it via theantenna ex201. Also, in the cell phone ex115, the communication circuitunit ex301 amplifies the data received by the antenna ex201 inconversation mode and performs frequency transformation and theanalog-to-digital conversion on the data, the modem circuit unit ex306performs inverse spread spectrum processing on the data, and the voiceprocessing unit ex305 converts it into analog voice data so as to outputit via the voice output unit ex208.

Furthermore, when transmitting an e-mail in data communication mode, thetext data of the e-mail inputted by operating the operation keys ex204of the main body is sent out to the main control unit ex311 via theoperation input control unit ex304. In the main control unit ex311,after the modem circuit unit ex306 performs spread spectrum processingon the text data and the communication circuit unit ex301 performs thedigital-to-analog conversion and the frequency transformation on thetext data, the data is transmitted to the cell site ex110 via theantenna ex201.

When picture data is transmitted in data communication mode, the picturedata shot by the camera unit ex203 is supplied to the picture codingunit ex312 via the camera interface unit ex303. When it is nottransmitted, it is also possible to display the picture data shot by thecamera unit ex203 directly on the display unit ex202 via the camerainterface unit ex303 and the LCD control unit ex302.

The picture coding unit ex312, which includes the picture codingapparatus as described in the present invention, compresses and codesthe picture data supplied from the camera unit ex203 using the codingmethod employed by the picture coding apparatus as shown in the firstembodiment so as to transform it into coded image data, and sends it outto the multiplexing/demultiplexing unit ex308. At this time, the cellphone ex115 sends out the voice received by the voice input unit ex205during the shooting with the camera unit ex203 to themultiplexing/demultiplexing unit ex308 as digital voice data via thevoice processing unit ex305.

The multiplexing/demultiplexing unit ex308 multiplexes the coded imagedata supplied from the picture coding unit ex312 and the voice datasupplied from the voice processing unit ex305, using a predeterminedmethod, then the modem circuit unit ex306 performs spread spectrumprocessing on the multiplexed data obtained as a result of themultiplexing, and lastly the communication circuit unit ex301 performsdigital-to-analog conversion and frequency transform on the data for thetransmission via the antenna ex201.

As for receiving data of a moving picture file which is linked to a Webpage or the like in data communication mode, the modem circuit unitex306 performs inverse spread spectrum processing on the data receivedfrom the cell site ex110 via the antenna ex201, and sends out themultiplexed data obtained as a result of the inverse spread spectrumprocessing.

In order to decode the multiplexed data received via the antenna ex201,the multiplexing/demultiplexing unit ex308 demultiplexes the multiplexeddata into a coded stream of image data and that of voice data, andsupplies the coded image data to the picture decoding unit ex309 and thevoice data to the voice processing unit ex305, respectively via thesynchronous bus ex313.

Next, the picture decoding unit ex309, including the picture decodingapparatus as described in the present invention, decodes the codedstream of the image data using the decoding method corresponding to thecoding method as shown in the above-mentioned embodiments to generatereproduced moving picture data, and supplies this data to the displayunit ex202 via the LCD control unit ex302, and thus the image dataincluded in the moving picture file linked to a Web page, for instance,is displayed. At the same time, the voice processing unit ex305 convertsthe voice data into analog voice data, and supplies this data to thevoice output unit ex208, and thus the voice data included in the movingpicture file linked to a Web page, for instance, is reproduced.

The present invention is not limited to the above-mentioned system sinceground-based or satellite digital broadcasting has been in the newslately and at least either the picture coding apparatus or the picturedecoding apparatus described in the above-mentioned embodiment can beincorporated into a digital broadcasting system as shown in FIG. 36.More specifically, a coded stream of video information is transmittedfrom a broadcast station ex409 to or communicated with a broadcastsatellite ex410 via radio waves. Upon receipt of it, the broadcastsatellite ex410 transmits radio waves for broadcasting. Then, a home-useantenna ex406 with a satellite broadcast reception function receives theradio waves, and a television (receiver) ex401 or a set top box (STB)ex407 decodes a coded bit stream for reproduction. The picture decodingapparatus as shown in the above-mentioned embodiment can be implementedin the reproducing apparatus ex403 for reading out and decoding thecoded stream recorded on a storage medium ex402 that is a recordingmedium such as a CD and a DVD. In this case, the reproduced movingpicture signals are displayed on a monitor ex404. It is also conceivableto implement the picture decoding apparatus in the set top box ex407connected to a cable ex405 for a cable television or the antenna ex406for satellite and/or ground-based broadcasting so as to reproduce themon a monitor ex408 of the television ex401. The picture decodingapparatus may be incorporated into the television, not in the set topbox. Also, a car ex412 having an antenna ex411 can receive signals fromthe satellite ex410 or the cell site ex107 for replaying moving pictureon a display device such as a car navigation system ex413 set in the carex412.

Furthermore, the picture coding apparatus as shown in theabove-mentioned embodiment can code picture signals and record them onthe storage medium. As a concrete example, a recorder ex420 such as aDVD recorder for recording picture signals on a DVD disk ex421, a diskrecorder for recording them on a hard disk can be cited. They can berecorded on an SD card ex422. When the recorder ex420 includes thepicture decoding apparatus as shown in the above-mentioned embodiment,the picture signals recorded on the DVD disk ex421 or the SD card ex422can be reproduced for display on the monitor ex408.

As for the structure of the car navigation system ex413, the structurewithout the camera unit ex203, the camera interface unit ex303 and thepicture coding unit ex312, out of the components shown in FIG. 35, isconceivable. The same applies for the computer ex111, the television(receiver) ex401 and others.

In addition, three types of implementations can be conceived for aterminal such as the cell phone ex114: a sending/receiving terminalimplemented with both an encoder and a decoder, a sending terminalimplemented with an encoder only, and a receiving terminal implementedwith a decoder only.

As described above, it is possible to use the variable length codingmethod, the variable length decoding method as well as the variablelength coding apparatus and the variable length decoding apparatus thatuse these method, the moving picture coding method, the moving picturedecoding method, the moving picture encoding apparatus and the movingpicture decoding apparatus, described in the above-mentioned embodiment,for any of the above-mentioned apparatuses and systems described above,and by using these methods, the effects described in the above-mentionedembodiments can be obtained.

From the invention thus described, it will be obvious that theembodiments of the invention may be varied in many ways. Such variationsare not to be regarded as a departure from the spirit and scope of theinvention, and all such modifications as would be obvious to one skilledin the art are intended for inclusion within the scope of the followingclaims.

It is described that the variable length coding apparatus and thevariable length decoding apparatus according to the first through sixthembodiments performs scanning on the coefficients in an order startingat the low-frequency component toward the high-frequency component.However, the scanning may be performed in an order starting at thehigh-frequency component toward the low-frequency component. In thiscase, processing of reordering the coefficients can be abbreviated.

Industrial Applicability

The variable length coding method and the variable length decodingmethod according to the present invention are applicable to code ordecode coefficients in each block having a predetermined size, which areobtained by performing frequency transformation on picture data of amoving picture using a computer apparatus such as a cell phone, apersonal digital assistant, a TV broadcasting apparatus, a TV monitor, aSet Top Box, or the like.

The invention claimed is:
 1. A coding method for performingvariable-length coding on two-dimensional coefficients of a block whichare obtained by performing frequency transformation on picture data ofthe block that has a predetermined size of pixels, the methodcomprising: scanning the two-dimensional coefficients of the block in apredetermined order starting from a low frequency component toward ahigh frequency component so as to obtain one-dimensional coefficients;transforming the one-dimensional coefficients into Run values and Levelvalues, wherein each of the Level values is a value of a coefficienthaving a non-zero value in the one-dimensional coefficients and each ofthe Run values is the number of successive zero-value coefficients inthe one-dimensional coefficients; and performing variable-length codingon the Run values and the Level values independently from a highfrequency component toward a low frequency component using a pluralityof variable length code tables for Run and for Level; wherein each ofthe plurality of variable length code tables for Level includes aplurality of variable length codes which correspond to the Level valuesof the coefficients, wherein said performing variable-length coding onthe Level values comprises: coding a Level value of a first coefficientusing a first variable length code table of the plurality of variablelength code tables for Level; determining whether or not an absoluteLevel value of the first coefficient exceeds a first threshold value bycomparing the absolute Level value of the first coefficient to the firstthreshold value; switching to a second variable length code table of theplurality of variable length code tables for Level only when it isdetermined that the absolute Level value of the first coefficientexceeds the first threshold value; coding a Level value of a secondcoefficient using the second variable length code table of the pluralityof variable length code tables for Level; determining whether or not anabsolute Level value of the second coefficient exceeds a secondthreshold value by comparing the absolute Level value of the secondcoefficient to the second threshold value, the second threshold valuebeing greater than the first threshold value; switching to a thirdvariable length code table of the plurality of variable length codetables for Level only when it is determined that the absolute Levelvalue of the second coefficient exceeds the second threshold value;coding a Level value of a third coefficient using the third variablelength code table of the plurality of variable length code tables forLevel; determining whether or not an absolute Level value of the thirdcoefficient exceeds a third threshold value by comparing the absoluteLevel value of the third coefficient to the third threshold value, thethird threshold value being greater than the second threshold value;switching to a fourth variable length code table of the plurality ofvariable length code tables for Level only when it is determined thatthe absolute Level value of the third coefficient exceeds the thirdthreshold value; and coding a Level value of a fourth coefficient usingthe fourth variable length code table of the plurality of variablelength code tables for Level, wherein each of the first threshold value,the second threshold value, and the third threshold value is determinedbased on a rate of change in code length of the variable length codesincluded in each of the variable length code tables for Level.
 2. Acoding apparatus that performs variable-length coding on two-dimensionalcoefficients of a block which are obtained by performing frequencytransformation on picture data of the block that has a predeterminedsize of pixels, the apparatus comprising: a scanning unit operable toscan the two-dimensional coefficients of the block in a predeterminedorder starting from a low frequency component toward a high frequencycomponent so as to obtain one-dimensional coefficients; a transformingunit operable to transform the one-dimensional coefficients into Runvalues and Level values, wherein each of the Level values is a value ofa coefficient having a non-zero value in the one-dimensionalcoefficients and each of the Run values is the number of successivezero-value coefficients in the one-dimensional coefficients; and avariable-length coding unit operable to perform variable-length codingon the Run values and the Level values independently from a highfrequency component toward a low frequency component using a pluralityof variable length code tables for Run and for Level; wherein each ofthe plurality of variable length code tables for Level includes aplurality of variable length codes which correspond to the Level valuesof the coefficients, wherein said variable-length coding unit isoperable to: code a Level value of a first coefficient using a firstvariable length code table of the plurality of variable length codetables for Level; and determine whether or not an absolute Level valueof the first coefficient exceeds a first threshold value by comparingthe absolute Level value of the first coefficient to the first thresholdvalue; switch to a second variable length code table of the plurality ofvariable length code tables for Level only when it is determined thatthe absolute Level value of the first coefficient exceeds the firstthreshold value; code a Level value of a second coefficient using thesecond variable length code table of the plurality of variable lengthcode tables for Level; determine whether or not an absolute Level valueof the second coefficient exceeds a second threshold value by comparingthe absolute Level value of the second coefficient to the secondthreshold value, the second threshold value being greater than the firstthreshold value; switch to a third variable length code table of theplurality of variable length code tables for Level only when it isdetermined that the absolute Level value of the second coefficientexceeds the second threshold value; code a Level value of a thirdcoefficient using the third variable length code table of the pluralityof variable length code tables for Level; determine whether or not anabsolute Level value of the third coefficient exceeds a third thresholdvalue by comparing the absolute Level value of the third coefficient tothe third threshold value, the third threshold value being greater thanthe second threshold value; switch to a fourth variable length codetable of the plurality of variable length code tables for Level onlywhen it is determined that the absolute Level value of the thirdcoefficient exceeds the third threshold value; and code a Level value ofa fourth coefficient using the fourth variable length code table of theplurality of variable length code tables for Level, wherein each of thefirst threshold value, the second threshold value, and the thirdthreshold value is determined based on a rate of change in code lengthof the variable length codes included in each of the variable lengthcode tables for Level.